Package net.sf.cglib.proxy

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


        Enhancer enhancer = new Enhancer();
        enhancer.setInterfaces(interfaces.toArray(new Class<?>[0]));
        enhancer.setCallbackTypes(new Class[] {FastDispatcher.class, Interceptor.class} );
        enhancer.setCallbackFilter(new InterceptorFilter(new StatementJavaProxy()));
        return enhancer.createClass();
    }

    @SuppressWarnings("unchecked")
    private Class<CallableStatement> createProxyCallableStatementClass() {
        Set<Class<?>> interfaces = ClassLoaderUtils.getAllInterfaces(CallableStatement.class);
View Full Code Here


        Enhancer enhancer = new Enhancer();
        enhancer.setInterfaces(interfaces.toArray(new Class<?>[0]));
        enhancer.setCallbackTypes(new Class[] {FastDispatcher.class, Interceptor.class} );
        enhancer.setCallbackFilter(new InterceptorFilter(new CallableStatementJavaProxy()));
        return enhancer.createClass();
    }

    @SuppressWarnings("unchecked")
    private Class<ResultSet> createProxyResultSetClass() {
        Set<Class<?>> interfaces = ClassLoaderUtils.getAllInterfaces(ResultSet.class);
View Full Code Here

        Enhancer enhancer = new Enhancer();
        enhancer.setInterfaces(interfaces.toArray(new Class<?>[0]));
        enhancer.setCallbackTypes(new Class[] {FastDispatcher.class, Interceptor.class} );
        enhancer.setCallbackFilter(new InterceptorFilter(new ResultSetJavaProxy()));
        return enhancer.createClass();
  }

    // ---------------------------------------------------------------
    //  CGLIB Classes
    // ---------------------------------------------------------------
View Full Code Here

        try {
            Enhancer enhancer = new Enhancer();
            enhancer.setInterfaces(new Class[] {forClass});
            enhancer.setCallbackFilter(FILTER);
            enhancer.setCallbackTypes(new Class[] {NoOp.class, MethodInterceptor.class});
            Class<?> newClass = enhancer.createClass();
            Enhancer.registerStaticCallbacks(newClass, new Callback[] {NoOp.INSTANCE,
                                                                       new InterfaceMethodInterceptor(reference, forClass)});
            result = newClass.newInstance();
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

                    return name;
                }
            });

            // generate the class
            Class result = enhancer.createClass();
            assert result != null;

            StubMethodInterceptor interceptor = new StubMethodInterceptor(iface);
            Ids ids = new Ids(iface);
            Enhancer.registerStaticCallbacks(result, new Callback[] {NoOp.INSTANCE, interceptor, ids});
View Full Code Here

                    classBytes = b;
                    return b;
                }
            });
            enhancer.setClassLoader(new URLClassLoader(new URL[0], this.getClass().getClassLoader()));
            Class type = enhancer.createClass();
            URI location = new URI("cglib/");
            context.addClass(location, type.getName(), classBytes);
            ClassLoader cl = context.getClassLoader();
            Class loadedType = cl.loadClass(type.getName());
            assertTrue(DataSource.class.isAssignableFrom(loadedType));
View Full Code Here

        enhancer.setInterfaces(new Class[]{Serializable.class});
        enhancer.setCallbackTypes(new Class[]{NoOp.class});
        enhancer.setUseFactory(false);
        ByteCode byteCode = new ByteCode();
        enhancer.setStrategy(byteCode);
        enhancer.createClass();

        return byteCode.getByteCode();
    }

    protected void tearDown() throws Exception {
View Full Code Here

        enhancer.setCallbackFilter(new NoOverrideCallbackFilter(GenericServiceEndpointWrapper.class));
        enhancer.setCallbackTypes(new Class[]{NoOp.class, MethodInterceptor.class});
        enhancer.setUseFactory(false);
        enhancer.setUseCache(false);

        return enhancer.createClass();
    }
    public Remote createServiceEndpoint() throws ServiceException {
        //TODO figure out why this can't be called in readResolve!
//        synchronized (this) {
//            if (!initialized) {
View Full Code Here

        enhancer.setInterfaces(new Class[]{serviceInterface});
        enhancer.setCallbackFilter(new NoOverrideCallbackFilter(Service.class));
        enhancer.setCallbackTypes(new Class[]{NoOp.class, MethodInterceptor.class});
        enhancer.setUseFactory(false);
        enhancer.setUseCache(false);
        Class serviceClass = enhancer.createClass();

        Enhancer.registerCallbacks(serviceClass, methodInterceptors);
        FastConstructor constructor = FastClass.create(serviceClass).getConstructor(SERVICE_CONSTRUCTOR_TYPES);
        try {
            return constructor.newInstance(new Object[]{seiPortNameToFactoryMap, seiClassNameToFactoryMap});
View Full Code Here

                }
            }
            enhancer.setClassLoader(classLoader);
            enhancer.setCallbackType(MethodInterceptor.class);
            enhancer.setUseFactory(false);
            proxyType = enhancer.createClass();
            fastClass = FastClass.create(proxyType);
        }

        public Object createProxy(AbstractName target) {
            assert target != null: "target is null";
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.