Package net.sf.cglib.proxy

Examples of net.sf.cglib.proxy.CallbackFilter


    // Create the proxied class.
    Enhancer enhancer = new Enhancer();
    enhancer.setSuperclass(declaringClass);
    enhancer.setUseCache(false); // We do enough caching.
    enhancer.setCallbackFilter(new CallbackFilter() {
      public int accept(Method method) {
        return indices.get(method);
      }
    });
    enhancer.setCallbackTypes(callbackTypes);
View Full Code Here


    // Construct the proxy object
    Enhancer ex = EnhancerFactory.getInstance().createEnhancer();
   
    // Attempt to share callback filter
    if (filter == null) {
      filter = new CallbackFilter() {
        @Override
        public int accept(Method method) {
          // Skip methods defined in Object
          if (WRITE_PACKET.isMatch(MethodInfo.fromMethod(method), null)) {
            writePacketIntercepted = true;
View Full Code Here

    }
   
    if (filter == null) {
      readPacketIntercepted = false;
     
      filter = new CallbackFilter() {
        @Override
        public int accept(Method method) {
          // Skip methods defined in Object
          if (method.getDeclaringClass().equals(Object.class)) {
            return 0;
View Full Code Here

        }
      };
     
      // Share callback filter - that way, we avoid generating a new class every time.
      if (callbackFilter == null) {
        callbackFilter = new CallbackFilter() {
          @Override
          public int accept(Method method) {
            if (method.equals(queueMethod))
              return 0;
            else
View Full Code Here

    callbacks[2] = NoOp.INSTANCE;
   
    Enhancer enhancer = EnhancerFactory.getInstance().createEnhancer();
    enhancer.setSuperclass(getSpigotListenerClass());
    enhancer.setCallbacks(callbacks);
    enhancer.setCallbackFilter(new CallbackFilter() {
      @Override
      public int accept(Method method) {
        // We'll be pretty stringent
        if (matchMethod("packetReceived", method)) {
          found[0] = true;
View Full Code Here

      }
      };
   
    // Shared callback filter
    if (callbackFilter == null) {
      callbackFilter = new CallbackFilter() {
        @Override
        public int accept(Method method) {
          // Do not override the object method or the superclass methods
          if (method.getDeclaringClass().equals(Object.class) ||
            method.getDeclaringClass().equals(InjectorContainer.class))
View Full Code Here

                MethodProxy arg3) throws Throwable {
                return null;
            }
        }
      });
      en.setCallbackFilter(new CallbackFilter() {
          public int accept(Method method) {
              if (method.getParameterTypes().length == 0 && method.getName().equals("finalize")) {
                  return 1;
              }
              return 0;
View Full Code Here

    final Class newClazz = (Class) beanGenerator.createClass();

    final Callback[] callbacks = new Callback[] { new GetCachingMethodInterceptor(clazz.newInstance()), NoOp.INSTANCE };

    return (ConnectionFactory) Enhancer.create(newClazz, new Class[] { ConnectionFactory.class, QueueConnectionFactory.class, TopicConnectionFactory.class }, new CallbackFilter() {
      public int accept(Method m) {
        return 0 ;
      }

    }, callbacks);
View Full Code Here

      this.callbackTypes.add(callback.getClass());
    }

    // Set up the callback filter to return the index of the BeanMethodInterceptor when
    // handling a @Bean-annotated method; otherwise, return index of the NoOp callback.
    callbackFilter = new CallbackFilter() {
      public int accept(Method candidateMethod) {
        if (BeanAnnotationHelper.isBeanAnnotated(candidateMethod)) {
          return 0;
        }
        if (DisposableBeanMethodInterceptor.isDestroyMethod(candidateMethod)) {
View Full Code Here

    private Object enhanceFactoryBean(Class<?> fbClass, String beanName) throws InstantiationException, IllegalAccessException {
      Enhancer enhancer = new Enhancer();
      enhancer.setUseCache(false);
      enhancer.setSuperclass(fbClass);
      enhancer.setUseFactory(false);
      enhancer.setCallbackFilter(new CallbackFilter() {
        public int accept(Method method) {
          return method.getName().equals("getObject") ? 0 : 1;
        }
      });
      List<Callback> callbackInstances = new ArrayList<Callback>();
View Full Code Here

TOP

Related Classes of net.sf.cglib.proxy.CallbackFilter

Copyright © 2018 www.massapicom. 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.