Package net.sf.cglib.proxy

Examples of net.sf.cglib.proxy.Enhancer.create()


      Object proxy;
      if (this.constructorArgs != null) {
        proxy = enhancer.create(this.constructorArgTypes, this.constructorArgs);
      }
      else {
        proxy = enhancer.create();
      }

      return proxy;
    }
    catch (CodeGenerationException ex) {
View Full Code Here


            final byte[] byteCode = generateRemoteInterface(targetJavaInterface);
            targetJavaInterface = classloader.defineClass(targetJavaInterface.getName(), byteCode);
            enhancer.setClassLoader(classloader);
        }
        enhancer.setInterfaces(new Class[] {targetJavaInterface});
        return (Remote)enhancer.create();
    }

    protected Object invokeTarget(Operation op, Object[] args) throws InvocationTargetException {
        return wire.invoke(op, args);
    }
View Full Code Here

        /*
         * In OSGi, the classloader for the interface cannot access the classes for the CGLIB 
         */
        enhancer.setClassLoader(new ClassLoaderDelegate(targetJavaInterface.getClassLoader(), getClass().getClassLoader()));
        enhancer.setInterfaces(new Class[] {targetJavaInterface});
        return (Remote)enhancer.create();
    }
   
    private Object invokeTarget(Operation op, Object[] args) throws InvocationTargetException {
        return endpoint.invoke(op, args);
    }
View Full Code Here

    public <T> T createProxy(final Class<T> interfaze, Invocable invocable) throws ProxyCreationException {
        if (invocable instanceof RuntimeEndpoint) {
            Enhancer enhancer = new Enhancer();
            enhancer.setSuperclass(interfaze);
            enhancer.setCallback(new CglibMethodInterceptor<T>(interfaze, invocable));
            Object proxy = enhancer.create();
            return interfaze.cast(proxy);
        }       
        ServiceReference<T> serviceReference = new ServiceReferenceImpl(interfaze, invocable, null);
        return createProxy(serviceReference);
    }
View Full Code Here

    public <T> T createProxy(ServiceReference<T> callableReference) throws ProxyCreationException {
        Enhancer enhancer = new Enhancer();
        Class<T> interfaze = callableReference.getBusinessInterface();
        enhancer.setSuperclass(interfaze);
        enhancer.setCallback(new CglibMethodInterceptor<T>(callableReference));
        Object proxy = enhancer.create();
    ((ServiceReferenceImpl)callableReference).setProxy(proxy);
        return interfaze.cast(proxy);
    }

    /**
 
View Full Code Here

    public <T> T createCallbackProxy(ServiceReference<T> callbackReference) throws ProxyCreationException {
        Enhancer enhancer = new Enhancer();
        Class<T> interfaze = callbackReference.getBusinessInterface();
        enhancer.setSuperclass(interfaze);
        enhancer.setCallback(new CglibMethodInterceptor<T>(callbackReference));
        Object object = enhancer.create();
        T proxy = interfaze.cast(object);
        ((ServiceReferenceExt<T>)callbackReference).setProxy(proxy);
        return proxy;
    }
View Full Code Here

            final byte[] byteCode = generateRemoteInterface(targetJavaInterface);
            targetJavaInterface = classloader.defineClass(byteCode);
            enhancer.setClassLoader(classloader);
        }
        enhancer.setInterfaces(new Class[] {targetJavaInterface});
        return (Remote)enhancer.create();
    }

    protected Object invokeTarget(Operation op, Object[] args) throws InvocationTargetException {

        Message requestMsg = new MessageImpl();
View Full Code Here

            final byte[] byteCode = generateRemoteInterface(targetJavaInterface);
            targetJavaInterface = classloader.defineClass(byteCode);
            enhancer.setClassLoader(classloader);
        }
        enhancer.setInterfaces(new Class[] {targetJavaInterface});
        return (Remote)enhancer.create();
    }

    protected Object invokeTarget(Operation op, Object[] args) throws InvocationTargetException {
        return wire.invoke(op, args);
    }
View Full Code Here

    public <T> T createProxy(CallableReference<T> callableReference) throws ProxyCreationException {
        Enhancer enhancer = new Enhancer();
        Class<T> interfaze = callableReference.getBusinessInterface();
        enhancer.setSuperclass(interfaze);
        enhancer.setCallback(new CglibMethodInterceptor<T>(callableReference));
        Object proxy = enhancer.create();
    ((CallableReferenceImpl)callableReference).setProxy(proxy);
        return interfaze.cast(proxy);
    }

    /**
 
View Full Code Here

    public <T> T createCallbackProxy(CallbackReferenceImpl<T> callbackReference) throws ProxyCreationException {
        Enhancer enhancer = new Enhancer();
        Class<T> interfaze = callbackReference.getBusinessInterface();
        enhancer.setSuperclass(interfaze);
        enhancer.setCallback(new CglibMethodInterceptor<T>(callbackReference));
        Object proxy = enhancer.create();
    callbackReference.setProxy(proxy);
        return interfaze.cast(proxy);
    }

    @SuppressWarnings("unchecked")
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.