Package net.sf.cglib.proxy

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


                    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


                }
            }
            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

                    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

                    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

                    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

    ex.setSuperclass(MinecraftReflection.getPacketClass());
    ex.setCallbackFilter(filter);
    ex.setUseCache(false);
   
    ex.setCallbackTypes( new Class[] { WritePacketModifier.class, WritePacketModifier.class });
    Class<?> proxyClass = ex.createClass();
   
    // Register write modifiers too
    Enhancer.registerStaticCallbacks(proxyClass, new Callback[] { modifierWrite, modifierRest });

    if (proxyClass != null) {
View Full Code Here

   
    // Subclass the specific packet class
    ex.setSuperclass(old);
    ex.setCallbackFilter(filter);
    ex.setCallbackTypes(new Class<?>[] { NoOp.class, ReadPacketModifier.class, ReadPacketModifier.class });
    Class proxy = ex.createClass();
   
    // Create the proxy handlers
    ReadPacketModifier modifierReadPacket = new ReadPacketModifier(packetID, this, reporter, true);
    ReadPacketModifier modifierRest = new ReadPacketModifier(packetID, this, reporter, false);
View Full Code Here

    ex.setSuperclass(MinecraftReflection.getPacketClass());
    ex.setInterfaces(new Class[] { FakePacket.class } );
    ex.setUseCache(true);
    ex.setCallbackType(InvertedIntegerCallback.class);

    Class<?> proxyClass = ex.createClass();
    Enhancer.registerCallbacks(proxyClass, new Callback[] { callback });
   
    try {
      // Temporarily associate the fake packet class
      invoker.registerPacketClass(proxyClass, type.getLegacyId());
View Full Code Here

                e.setUseCache(false);
                e.setAttemptLoad(true);
                e.setNamingPolicy(new MunitNamingPolicy());
                e.setCallbackTypes(new Class[] {WrapperMunitMessageProcessorInterceptor.class});

                return createProxy(e.createClass(), callback);

            }
            else
            {
                return o;
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.