Examples of MethodInterceptor


Examples of net.sf.cglib.proxy.MethodInterceptor

        }
        if (superClass != null) {
            Enhancer enhancer = new Enhancer();
            enhancer.setSuperclass(superClass);
            enhancer.setInterfaces(theInterfaces.toArray(new Class[]{}));
            enhancer.setCallback(new MethodInterceptor() {

                public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy)
                    throws Throwable {
                    return h.invoke(obj, method, args);
                }
View Full Code Here

Examples of net.sf.cglib.proxy.MethodInterceptor

    }

    protected 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

    }

    protected 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

    public 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 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

    }

    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 org.aopalliance.intercept.MethodInterceptor

        this.bind(ConfigurationState.class).toProvider(ConfigurationStateProvider.class);
        this.bind(ValidatorFactory.class).toProvider(ValidatorFactoryProvider.class);
        this.bind(Validator.class).toProvider(ValidatorProvider.class);

        // AOP stuff
        MethodInterceptor validateMethodInterceptor = new ValidateMethodInterceptor();
        this.binder().requestInjection(validateMethodInterceptor);
        this.bindInterceptor(Matchers.any(), Matchers.annotatedWith(Validate.class), validateMethodInterceptor);
    }
View Full Code Here

Examples of org.aopalliance.intercept.MethodInterceptor

/*if[AOP]*/
  public void testToConstructorAndMethodInterceptors() throws NoSuchMethodException {
    final Constructor<D> constructor = D.class.getConstructor(Stage.class);
    final AtomicInteger count = new AtomicInteger();
    final MethodInterceptor countingInterceptor = new MethodInterceptor() {
      public Object invoke(MethodInvocation methodInvocation) throws Throwable {
        count.incrementAndGet();
        return methodInvocation.proceed();
      }
    };
View Full Code Here

Examples of org.aopalliance.intercept.MethodInterceptor

    private ApplicationContext applicationContext;

    @Bean
    Authentication currentUser() {
        return ProxyFactory.getProxy(Authentication.class, new MethodInterceptor() {
            @Override
            public Object invoke(MethodInvocation invocation) throws Throwable {
                SecurityContext securityContext = SecurityContextHolder.getContext();
                Authentication authentication = securityContext.getAuthentication();
                if (authentication == null) {
View Full Code Here

Examples of org.aopalliance.intercept.MethodInterceptor

  public <T> void hear(TypeLiteral<T> literal, TypeEncounter<T> encounter) {
    Class<? super T> klass = literal.getRawType();

    do {
      for (Method method : klass.getDeclaredMethods()) {
        final MethodInterceptor interceptor = InstrumentedInterceptor.forMethod(metricsSystem, klass, method);
        if (interceptor != null) {
          encounter.bindInterceptor(Matchers.only(method).and(new NotSynthetic()), interceptor);
        }
      }
    } while ((klass = klass.getSuperclass()) != null);
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.