站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.0.5 API 文档英文版

DefaultAdvisorAdapterRegistry (Spring Framework API 2.0) - Spring Framework 2.0.5 API 文档英文版

The Spring Framework

org.springframework.aop.framework.adapter
Class DefaultAdvisorAdapterRegistry

java.lang.Object
  extended by org.springframework.aop.framework.adapter.DefaultAdvisorAdapterRegistry
All Implemented Interfaces:
AdvisorAdapterRegistry

public class DefaultAdvisorAdapterRegistry
extends Object
implements AdvisorAdapterRegistry

Default implementation of the AdvisorAdapterRegistry interface. Supports MethodInterceptor, MethodBeforeAdvice, AfterReturningAdvice, ThrowsAdvice.

Author:
Rod Johnson, Rob Harrop

Constructor Summary
DefaultAdvisorAdapterRegistry()
          Create a new DefaultAdvisorAdapterRegistry, registering well-known adapters.
 
Method Summary
 MethodInterceptor[] getInterceptors(Advisor advisor)
          Return an array of AOP Alliance MethodInterceptors to allow use of the given Advisor in an interception-based framework.
 void registerAdvisorAdapter(AdvisorAdapter adapter)
          Register the given AdvisorAdapter.
 Advisor wrap(Object adviceObject)
          Return an Advisor wrapping the given advice.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAdvisorAdapterRegistry

public DefaultAdvisorAdapterRegistry()
Create a new DefaultAdvisorAdapterRegistry, registering well-known adapters.

Method Detail

wrap

public Advisor wrap(Object adviceObject)
             throws UnknownAdviceTypeException
Description copied from interface: AdvisorAdapterRegistry
Return an Advisor wrapping the given advice.

Should by default at least support MethodInterceptor, MethodBeforeAdvice, AfterReturningAdvice, ThrowsAdvice.

Specified by:
wrap in interface AdvisorAdapterRegistry
Parameters:
adviceObject - object that should be an advice
Returns:
an Advisor wrapping the given advice. Never returns null. If the advice parameter is an Advisor, return it.
Throws:
UnknownAdviceTypeException - if no registered advisor adapter can wrap the supposed advice

getInterceptors

public MethodInterceptor[] getInterceptors(Advisor advisor)
                                    throws UnknownAdviceTypeException
Description copied from interface: AdvisorAdapterRegistry
Return an array of AOP Alliance MethodInterceptors to allow use of the given Advisor in an interception-based framework.

Don't worry about the pointcut associated with the Advisor, if it's a PointcutAdvisor: just return an interceptor.

Specified by:
getInterceptors in interface AdvisorAdapterRegistry
Parameters:
advisor - Advisor to find an interceptor for
Returns:
an array of MethodInterceptors to expose this Advisor's behavior
Throws:
UnknownAdviceTypeException - if the Advisor type is not understood by any registered AdvisorAdapter.

registerAdvisorAdapter

public void registerAdvisorAdapter(AdvisorAdapter adapter)
Description copied from interface: AdvisorAdapterRegistry
Register the given AdvisorAdapter. Note that it is not necessary to register adapters for an AOP Alliance Interceptors or Spring Advices: these must be automatically recognized by an AdvisorAdapterRegistry implementation.

Specified by:
registerAdvisorAdapter in interface AdvisorAdapterRegistry
Parameters:
adapter - AdvisorAdapter that understands a particular Advisor or Advice types

The Spring Framework

Copyright © 2002-2007 The Spring Framework.