Example usage for org.springframework.aop.framework AopProxy getProxy

List of usage examples for org.springframework.aop.framework AopProxy getProxy

Introduction

In this page you can find the example usage for org.springframework.aop.framework AopProxy getProxy.

Prototype

Object getProxy();

Source Link

Document

Create a new proxy object.

Usage

From source file:org.piraso.proxy.RegexProxyFactory.java

@SuppressWarnings("unchecked")
public ProxyInterceptorAware<T> getProxyInterceptor(T object) {
    RegexMethodInterceptor<T> wrapper = new RegexMethodInterceptorWrapper(new RegexMethodInterceptor<T>(),
            object);/*from w  w  w . java2s .c o m*/
    wrapper.addAllMethodListener(listeners);

    T proxy;

    if (clazz.isInterface()) {
        proxy = ProxyFactory.getProxy(clazz, wrapper);
    } else {
        AdvisedSupport advisedSupport = new AdvisedSupport();
        advisedSupport.setTarget(object);
        advisedSupport.addAdvice(wrapper);
        AopProxy aopProxy = new DefaultAopProxyFactory().createAopProxy(advisedSupport);
        proxy = (T) aopProxy.getProxy();
    }

    return new ProxyInterceptorAware<T>(proxy, wrapper);
}