Package net.sf.cglib.proxy

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


              return 0;
          }}
         );

      try {
          return (T)en.create();
      } catch(Throwable e) {
          s_logger.error("Unexpected exception", e);
      }

      return null;
View Full Code Here


            enhancer.setSuperclass(beanClass);
            enhancer.setCallbacks(getCallbacks());
            enhancer.setCallbackFilter(getCallbackFilter());
            enhancer.setNamingPolicy(ComponentNamingPolicy.INSTANCE);
           
            Object bean = enhancer.create();
            return bean;
      }
    }
    return null;
  }
View Full Code Here

        for (Class<?> clazz : clazzes) {
            GenericDao<?,?> dao = GenericDaoBase.getDao(clazz);
            Enhancer searchEnhancer = new Enhancer();
            searchEnhancer.setSuperclass(clazz);
            searchEnhancer.setCallback(this);
            Object entity = searchEnhancer.create();
           
            _entities.put(clazz, new Pair<GenericDao<?, ?>, Object>(dao, entity));
        }
    }
   
View Full Code Here

        _entities = new HashMap<Class<?>, Pair<GenericDao<?,?>, Object>>(1);
        GenericDao<?,?> dao = GenericDaoBase.getDao(entityClass);
        Enhancer searchEnhancer = new Enhancer();
        searchEnhancer.setSuperclass(entityClass);
        searchEnhancer.setCallback(this);
        Object entity = searchEnhancer.create();
       
        _entities.put(entityClass, new Pair<GenericDao<?, ?>, Object>(dao, entity));
    }
   
    @Override
View Full Code Here

        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(renderKit.getClass());
        enhancer.setCallback(new ExtValGenericRenderKit(renderKit));
        enhancer.setClassLoader(Thread.currentThread().getContextClassLoader());

        return (RenderKit) enhancer.create();
    }

    public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable
    {
        if(method.getName().equals("getRenderer"))
View Full Code Here

        {
          return super.getClassName("WICKET_" + prefix, source, key, names);
        }
      });

      return e.create();
    }
  }

  /**
   * This interface is used to make the proxy forward writeReplace() call to the handler instead
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

        /*
         * In OSGi, the classloader for the interface cannot access the classes for the CGLIB 
         */
        enhancer.setClassLoader(new MixedClassLoader(targetJavaInterface.getClassLoader(), getClass().getClassLoader()));
        enhancer.setInterfaces(new Class[] {targetJavaInterface});
        return (Remote)enhancer.create();
    }
   
    private static class MixedClassLoader extends ClassLoader {
        private ClassLoader runtime;

View Full Code Here

    try {
      DataFactory interceptor = new DataFactory(manager,object,executeImmediate);
      Enhancer e = new Enhancer();
      e.setSuperclass(object.getClass());
      e.setCallback(interceptor);
      Object bean = e.create();
      return (T) bean;
    } catch (Throwable e) {
      e.printStackTrace();
      throw new Error(e.getMessage());
    }
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.