Examples of MethodInterceptor


Examples of net.sf.cglib.proxy.MethodInterceptor

    public boolean isProxy(Object proxy) {
        return interceptors.containsKey(proxy);
    }

    public AbstractName getProxyTarget(Object proxy) {
        MethodInterceptor methodInterceptor = (MethodInterceptor) interceptors.get(proxy);
        if (methodInterceptor == null) {
            return null;
        }
        return getAbstractName(methodInterceptor);
    }
View Full Code Here

Examples of net.sf.cglib.proxy.MethodInterceptor

    }
   
      // MORE CGLIB magic!
      Enhancer ex = EnhancerFactory.getInstance().createEnhancer();
      ex.setSuperclass(Player.class);
      ex.setCallback(new MethodInterceptor() {
      @Override
      public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
       
        // There's no overloaded methods, so we don't care
        Method offlineMethod = lookup.get(method.getName());
View Full Code Here

Examples of net.sf.cglib.proxy.MethodInterceptor

    public synchronized void destroyProxy(Object proxy) {
        if (proxy == null) {
            return;
        }

        MethodInterceptor methodInterceptor = (MethodInterceptor) interceptors.remove(proxy);
        if (methodInterceptor != null) {
            doDestroy(methodInterceptor);
        }
    }
View Full Code Here

Examples of net.sf.cglib.proxy.MethodInterceptor

    public boolean isProxy(Object proxy) {
        return interceptors.containsKey(proxy);
    }

    public synchronized ObjectName getProxyTarget(Object proxy) {
        MethodInterceptor methodInterceptor = (MethodInterceptor) interceptors.get(proxy);
        if (methodInterceptor == null) {
            return null;
        }
        return getObjectName(methodInterceptor);
    }
View Full Code Here

Examples of net.sf.cglib.proxy.MethodInterceptor

    }
  }

  @Test
  public void shouldProxyTypesWithNonDefaultConstructor() {
    MethodInterceptor interceptor = mock(MethodInterceptor.class);
    assertTrue(ProxyFactory.proxyFor(A1.class, interceptor, null) instanceof A1);
    assertTrue(ProxyFactory.proxyFor(A2.class, interceptor, null) instanceof A2);
  }
View Full Code Here

Examples of net.sf.cglib.proxy.MethodInterceptor

    }

    private Remote createRmiService(final Interface serviceInterface) {
        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(UnicastRemoteObject.class);
        enhancer.setCallback(new MethodInterceptor() {
            public Object intercept(Object arg0, Method method, Object[] args, MethodProxy arg3) throws Throwable {
                try {
                    return invokeTarget(JavaInterfaceUtil.findOperation(method, serviceInterface.getOperations()), args);
                } catch (InvocationTargetException e) {
                    final Throwable cause = e.getCause();
View Full Code Here

Examples of net.sf.cglib.proxy.MethodInterceptor

      String clzName = clz.getName();
      if(clzName.contains("EnhancerByCloudStack"))
          clz = clz.getSuperclass();

      en.setSuperclass(clz);
      en.setCallbacks(new Callback[]{new MethodInterceptor() {
            @Override
            public Object intercept(Object arg0, Method arg1, Object[] arg2,
                MethodProxy arg3) throws Throwable {
                _callbackMethod = arg1;
                _callbackMethod.setAccessible(true);
                return null;
            }
        },
        new MethodInterceptor() {
            @Override
            public Object intercept(Object arg0, Method arg1, Object[] arg2,
                MethodProxy arg3) throws Throwable {
                return null;
            }
View Full Code Here

Examples of net.sf.cglib.proxy.MethodInterceptor

    _targetObject = target;
  }
 
  @SuppressWarnings("unchecked")
  public T getTarget() {
    return (T)Enhancer.create(_targetObject.getClass(), new MethodInterceptor() {
      @Override
      public Object intercept(Object arg0, Method arg1, Object[] arg2,
        MethodProxy arg3) throws Throwable {
        _callbackMethod = arg1;
        return null;
View Full Code Here

Examples of net.sf.cglib.proxy.MethodInterceptor

    }

    private Remote createRmiService(final Interface serviceInterface) {
        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(UnicastRemoteObject.class);
        enhancer.setCallback(new MethodInterceptor() {
            public Object intercept(Object arg0, Method method, Object[] args, MethodProxy arg3) throws Throwable {
                try {
                    return invokeTarget(JavaInterfaceUtil.findOperation(method, serviceInterface.getOperations()), args);
                } catch (InvocationTargetException e) {
                    final Throwable cause = e.getCause();
View Full Code Here

Examples of net.sf.cglib.proxy.MethodInterceptor

    }

    private Remote createRmiService(final Interface serviceInterface) {
        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(UnicastRemoteObject.class);
        enhancer.setCallback(new MethodInterceptor() {
            public Object intercept(Object arg0, Method method, Object[] args, MethodProxy arg3) throws Throwable {
                try {
                    return invokeTarget(JavaInterfaceUtil.findOperation(method, serviceInterface.getOperations()), args);
                } catch (InvocationTargetException e) {
                    final Throwable cause = e.getCause();
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.