Example usage for org.springframework.aop.framework AdvisedSupport isExposeProxy

List of usage examples for org.springframework.aop.framework AdvisedSupport isExposeProxy

Introduction

In this page you can find the example usage for org.springframework.aop.framework AdvisedSupport isExposeProxy.

Prototype

public boolean isExposeProxy() 

Source Link

Document

Return whether the AOP proxy will expose the AOP proxy for each invocation.

Usage

From source file:org.springframework.aop.framework.asm.DefaultCodeGenerationStrategySelector.java

public CodeGenerationStrategy select(AdvisedSupport advised, Method method, Class targetClass) {
    if (Advised.class == method.getDeclaringClass()) {
        return new AdvisedMixinCodeGenerationStrategy();
    }//from   w ww .ja v a  2  s.  co  m

    // need the advice chain to do perform anymore selections
    List chain = advised.getAdvisorChainFactory().getInterceptorsAndDynamicInterceptionAdvice(advised, method,
            targetClass);

    CodeGenerationStrategy strategy = null;

    if (isHashCodeMethod(method)) {
        strategy = new HashCodeCodeGenerationStrategy();
    }

    // TODO: consider adding explicit expose proxy support to certain strategies
    // TODO: consider factoring out certain calls such as release for the target source
    if (chain.isEmpty() && (!advised.isExposeProxy())) {
        if (advised.getTargetSource().isStatic()) {
            strategy = new StraightToTargetCodeGenerationStrategy();
        } else {
            strategy = new NonStaticTargetSourceCodeGenerationStrategy();
        }
        // TODO: add explicit support for empty target source
    } else {
        // TODO: add explicit support for static target sources
        // TODO: add explicit support for an empty target source
        // TODO: add agressive inlining for before/after advice
        strategy = new AdvisedCodeGenerationStrategy();
    }

    if (logger.isInfoEnabled()) {
        logger.info("Selected strategy [" + strategy.getClass().getName() + "] for method [" + method + "].");
    }

    return strategy;
}