Example usage for org.springframework.aop.framework ProxyFactory setExposeProxy

List of usage examples for org.springframework.aop.framework ProxyFactory setExposeProxy

Introduction

In this page you can find the example usage for org.springframework.aop.framework ProxyFactory setExposeProxy.

Prototype

public void setExposeProxy(boolean exposeProxy) 

Source Link

Document

Set whether the proxy should be exposed by the AOP framework as a ThreadLocal for retrieval via the AopContext class.

Usage

From source file:org.jdal.aop.SerializableProxyUtils.java

/**
 * Create a new Serializable proxy for the given target.
 * @param target target to proxy/* w ww .j  ava  2 s  .co  m*/
 * @param reference serializable reference 
 * @return a new serializable proxy
 */
private static Object createSerializableProxy(Object target, SerializableReference reference) {
    ProxyFactory pf = new ProxyFactory(target);
    pf.setExposeProxy(true);
    pf.setProxyTargetClass(reference.isProxyTargetClass());
    pf.addInterface(SerializableObject.class);
    pf.addAdvice(new SerializableIntroductionInterceptor(reference));

    return pf.getProxy(reference.getBeanFactory().getBeanClassLoader());
}

From source file:org.LexGrid.LexBIG.caCore.utils.LexEVSCaCoreUtils.java

public static Object createProxy(Object objectToProxy, ApplicationService advice, ProxyHelper proxyHelper) {
    ProxyFactory pf = new ProxyFactory(objectToProxy);
    pf.setProxyTargetClass(true);/*from  www.j ava2 s  . c o  m*/
    pf.addAdvice(new LexEVSBeanProxy(advice, proxyHelper));
    pf.setExposeProxy(true);
    return pf.getProxy();
}

From source file:org.LexGrid.LexBIG.caCore.client.proxy.DataServiceProxyHelperImpl.java

@Override
protected Object convertObjectToProxy(ApplicationService as, Object obj) {
    if (null == obj)
        return null;

    if (obj instanceof Integer || obj instanceof Float || obj instanceof Double || obj instanceof Character
            || obj instanceof Long || obj instanceof Boolean || obj instanceof String || obj instanceof Date
            || obj instanceof LexEVSBeanProxy || obj instanceof BeanProxy)
        return obj;

    ProxyFactory pf = new ProxyFactory(obj);
    pf.setProxyTargetClass(true);/*  ww w  .ja v  a 2  s . c  o  m*/
    pf.addAdvice(new LexEVSBeanProxy(as, this));
    pf.setExposeProxy(true);
    return pf.getProxy();
}

From source file:aop.DeclareMixinAspectJAdvisorFactoryTest.java

protected Object createProxy(Object target, List<Advisor> advisors, Class<?>... interfaces) {
    ProxyFactory pf = new ProxyFactory(target);
    if (interfaces.length > 1 || interfaces[0].isInterface()) {
        pf.setInterfaces(interfaces);/*from   w w w. j  av  a  2  s . c  om*/
    } else {
        pf.setProxyTargetClass(true);
    }

    // Required everywhere we use AspectJ proxies
    pf.addAdvice(ExposeInvocationInterceptor.INSTANCE);

    for (Object a : advisors) {
        pf.addAdvisor((Advisor) a);
    }

    pf.setExposeProxy(true);
    return pf.getProxy();
}