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


          readDetected = true;
        }
        throw new RuntimeException("Stop execution.");
      }
    });
    Object compound = enhancer.create();
    Object tileEntity = tileEntityField.get(blockState);
   
    // Look in every read/write like method
    for (Method method : FuzzyReflection.fromObject(tileEntity, true).
        getMethodListByParameters(Void.TYPE, new Class<?>[] { nbtCompoundClass })) {
View Full Code Here

    return new DefaultInstances(this) {
      @SuppressWarnings("unchecked")
      @Override
      protected <T> T createInstance(Class<T> type, Constructor<T> constructor, Class<?>[] types, Object[] params) {
        // Use the enhancer instead
        return (T) ex.create(types, params);
      }
    };
  }
 
  /**
 
View Full Code Here

      ex.setSuperclass(networkInterface);
      ex.setCallbacks(new Callback[] { queueFilter, dispatch });
      ex.setCallbackFilter(callbackFilter);
     
      // Inject it, if we can.
      networkManagerRef.setValue(ex.create());
    }
  }
 
  @Override
  protected void cleanHook() {
View Full Code Here

          return proxy.invokeSuper(obj, args);
        }
      });
     
      // Create our proxy object
      Object javaProxy = enhancer.create(
        new Class<?>[] { ByteBuf.class },
        new Object[]   { UnpooledByteBufAllocator.DEFAULT.buffer() }
      );
     
      Object lookPacket = new PacketContainer(PacketType.Play.Client.BLOCK_PLACE).getHandle();
View Full Code Here

      });
     
      // Create our listener
      Object playerProxyLow = playerLow.create();
      Object playerProxy = playerEx.create();
      Object serverProxy = serverEx.create();
     
      registerEvent.invoke(manager, playerJoinType, playerProxyLow, priorityLowest, plugin);
      registerEvent.invoke(manager, playerJoinType, playerProxy, priorityMonitor, plugin);
      registerEvent.invoke(manager, playerQuitType, playerProxy, priorityMonitor, plugin);
      registerEvent.invoke(manager, pluginDisabledType, serverProxy, priorityMonitor, plugin);
View Full Code Here

          found[2] = true;
          return 2;
        }
      }
    });
    dynamicListener = enhancer.create();
   
    // Verify methods
    if (!found[0])
      throw new IllegalStateException("Unable to find a valid packet receiver in Spigot.");
    if (!found[1])
View Full Code Here

    public Object create(Class realMpClass, MessageProcessorId id, Map<String, String> attributes, String fileName, String lineNumber)
    {
        try
        {
            Enhancer e = createEnhancer(realMpClass, id, attributes, fileName, lineNumber);
            return e.create();
        }
        catch (Throwable e)
        {
            logger.warn("The message processor " + id.getFullName() + " could not be mocked");
            try
View Full Code Here

            if (constructorArguments != null && constructorArguments.length != 0)
            {
                Class[] classes = findConstructorArgumentTypes(realMpClass, constructorArguments);
                if (classes != null)
                {
                    return e.create(classes, constructorArguments);
                }
                else
                {
                    throw new Error("The message processor " + id.getFullName() + " could not be created, because " +
                                    "there is no matching constructor");
View Full Code Here

                                    "there is no matching constructor");
                }
            }
            else
            {
                return e.create();
            }
        }
        catch (Throwable e)
        {
            logger.warn("The message processor " + id.getFullName() + " could not be mocked");
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.