Package net.sf.cglib.proxy

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


    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


            public Object loadObject() throws Exception {
                return dispatcher.call();
            }
        });
        e.setUseFactory(false);
        return e.create();
    }

    private static Class<?>[] getInterfaces(Class<?>[] classes) {
        Set<Class<?>> interfaces = new HashSet<Class<?>>();
        for (Class<?> clazz : classes) {
View Full Code Here

                        return super.getClassName(prefix, source, key, names);
                    }
                }});
            e.setSuperclass(type);
            e.setCallback(invocationHandler);
            return (T) e.create();           
        }
    }
   
    // Public only because JNA doesn't call setAccessible to access ctor.
    public static class ProxyID extends ID {
View Full Code Here

          new LookupOverrideMethodInterceptor(),
          new ReplaceOverrideMethodInterceptor()
      });

      return (ctor == null) ?
          enhancer.create() :
          enhancer.create(ctor.getParameterTypes(), args);
    }


    /**
 
View Full Code Here

          new ReplaceOverrideMethodInterceptor()
      });

      return (ctor == null) ?
          enhancer.create() :
          enhancer.create(ctor.getParameterTypes(), args);
    }


    /**
     * Class providing hashCode and equals methods required by CGLIB to
View Full Code Here

      enhancer.setCallbackTypes(types);

      // Generate the proxy class and create a proxy instance.
      Object proxy;
      if (this.constructorArgs != null) {
        proxy = enhancer.create(this.constructorArgTypes, this.constructorArgs);
      }
      else {
        proxy = enhancer.create();
      }
View Full Code Here

      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

      enhancer.setCallbackTypes(types);

      // Generate the proxy class and create a proxy instance.
      Object proxy;
      if (this.constructorArgs != null) {
        proxy = enhancer.create(this.constructorArgTypes, this.constructorArgs);
      }
      else {
        proxy = enhancer.create();
      }
View Full Code Here

      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

      enhancer.setCallbackTypes(types);

      // Generate the proxy class and create a proxy instance.
      Object proxy;
      if (this.constructorArgs != null) {
        proxy = enhancer.create(this.constructorArgTypes, this.constructorArgs);
      }
      else {
        proxy = enhancer.create();
      }
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.