Save This Page
Home » spring-framework-2.5.5-with-dependencies » org.springframework » aop » framework » [javadoc | source]
org.springframework.aop.framework
public interface: Advised [javadoc | source]

All Implemented Interfaces:
    TargetClassAware

All Known Implementing Classes:
    ProxyFactoryBean, AspectJProxyFactory, ProxyFactory, AdvisedSupport, ProxyCreatorSupport

Interface to be implemented by classes that hold the configuration of a factory of AOP proxies. This configuration includes the Interceptors and other advice, and Advisors, and the proxied interfaces.

Any AOP proxy obtained from Spring can be cast to this interface to allow manipulation of its AOP advice.

Method from org.springframework.aop.framework.Advised Summary:
addAdvice,   addAdvice,   addAdvisor,   addAdvisor,   getAdvisors,   getProxiedInterfaces,   getTargetSource,   indexOf,   indexOf,   isExposeProxy,   isFrozen,   isInterfaceProxied,   isPreFiltered,   isProxyTargetClass,   removeAdvice,   removeAdvisor,   removeAdvisor,   replaceAdvisor,   setExposeProxy,   setPreFiltered,   setTargetSource,   toProxyConfigString
Method from org.springframework.aop.framework.Advised Detail:
 public  void addAdvice(Advice advice) throws AopConfigException
    Add the given AOP Alliance advice to the tail of the advice (interceptor) chain.

    This will be wrapped in a DefaultPointcutAdvisor with a pointcut that always applies, and returned from the getAdvisors() method in this wrapped form.

    Note that the given advice will apply to all invocations on the proxy, even to the toString() method! Use appropriate advice implementations or specify appropriate pointcuts to apply to a narrower set of methods.

 public  void addAdvice(int pos,
    Advice advice) throws AopConfigException
    Add the given AOP Alliance Advice at the specified position in the advice chain.

    This will be wrapped in a org.springframework.aop.support.DefaultPointcutAdvisor with a pointcut that always applies, and returned from the #getAdvisors() method in this wrapped form.

    Note: The given advice will apply to all invocations on the proxy, even to the toString() method! Use appropriate advice implementations or specify appropriate pointcuts to apply to a narrower set of methods.

 public  void addAdvisor(Advisor advisor) throws AopConfigException
 public  void addAdvisor(int pos,
    Advisor advisor) throws AopConfigException
    Add an Advisor at the specified position in the chain.
 public Advisor[] getAdvisors()
    Return the advisors applying to this proxy.
 public Class[] getProxiedInterfaces()
    Return the interfaces proxied by the AOP proxy. Will not include the target class, which may also be proxied.
 public TargetSource getTargetSource()
    Return the TargetSource used by this Advised object.
 public int indexOf(Advisor advisor)
    Return the index (from 0) of the given advisor, or -1 if no such advisor applies to this proxy.

    The return value of this method can be used to index into the advisors array.

 public int indexOf(Advice advice)
    Return the index (from 0) of the given AOP Alliance Advice, or -1 if no such advice is an advice for this proxy.

    The return value of this method can be used to index into the advisors array.

 public boolean isExposeProxy()
    Return whether the factory should expose the proxy as a ThreadLocal. This can be necessary if a target object needs to invoke a method on itself benefitting from advice. (If it invokes a method on this no advice will apply.) Getting the proxy is analogous to an EJB calling getEJBObject().
 public boolean isFrozen()
    Return whether the Advised configuration is frozen, in which case no advice changes can be made.
 public boolean isInterfaceProxied(Class intf)
    Determine whether the given interface is proxied.
 public boolean isPreFiltered()
    Return whether this proxy configuration is pre-filtered so that it only contains applicable advisors (matching this proxy's target class).
 public boolean isProxyTargetClass()
    Are we proxying the full target class instead of specified interfaces?
 public boolean removeAdvice(Advice advice)
    Remove the Advisor containing the given advice.
 public boolean removeAdvisor(Advisor advisor)
    Remove the given advisor.
 public  void removeAdvisor(int index) throws AopConfigException
    Remove the advisor at the given index.
 public boolean replaceAdvisor(Advisor a,
    Advisor b) throws AopConfigException
    Replace the given advisor.

    Note: If the advisor is an org.springframework.aop.IntroductionAdvisor and the replacement is not or implements different interfaces, the proxy will need to be re-obtained or the old interfaces won't be supported and the new interface won't be implemented.

 public  void setExposeProxy(boolean exposeProxy)
    Set whether the proxy should be exposed by the AOP framework as a ThreadLocal for retrieval via the AopContext class. This is useful if an advised object needs to call another advised method on itself. (If it uses this, the invocation will not be advised).

    Default is "false", for optimal performance.

 public  void setPreFiltered(boolean preFiltered)
    Set whether this proxy configuration is pre-filtered so that it only contains applicable advisors (matching this proxy's target class).

    Default is "false". Set this to "true" if the advisors have been pre-filtered already, meaning that the ClassFilter check can be skipped when building the actual advisor chain for proxy invocations.

 public  void setTargetSource(TargetSource targetSource)
    Change the TargetSource used by this Advised object. Only works if the configuration isn't frozen.
 public String toProxyConfigString()
    As toString() will normally be delegated to the target, this returns the equivalent for the AOP proxy.