public static Object create()

in src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorFactory.java [52:93]


    public static Object create(
        String serviceName,
        String serviceShorthand,
        ServiceManager serviceManager,
        String[] serviceInterceptorList,
        Object serviceDelegate )
        throws ServiceException
    {
        Validate.notEmpty(serviceName,"serviceName");
        Validate.notEmpty(serviceShorthand,"serviceShorthand");
        Validate.notNull(serviceManager,"serviceManager");
        Validate.notNull(serviceInterceptorList,"serviceInterceptorList");
        Validate.notNull(serviceDelegate,"serviceDelegate");

        Object result;

        Class<? extends Object> clazz = serviceDelegate.getClass();
        ClassLoader classLoader = clazz.getClassLoader();
        List<?> interfaceList = Clazz.getAllInterfaces(clazz);

        // get the service interfaces to avoid look-ups

        AvalonInterceptorService[] avalonInterceptorServices = resolve(
            serviceManager,
            serviceInterceptorList
            );

        InvocationHandler invocationHandler = new AvalonInterceptorInvocationHandler(
            serviceName,
            serviceShorthand,
            serviceDelegate,
            avalonInterceptorServices
            );

        result = Proxy.newProxyInstance(
            classLoader,
            (Class[]) interfaceList.toArray(new Class[interfaceList.size()]),
            invocationHandler
            );

        return result;
    }