类 AspectJProxyFactory
java.lang.Object
infra.aop.framework.ProxyConfig
infra.aop.framework.AdvisedSupport
infra.aop.framework.ProxyCreatorSupport
infra.aop.aspectj.annotation.AspectJProxyFactory
- 所有已实现的接口:
Advised,TargetClassAware,Serializable
AspectJ-based proxy factory, allowing for programmatic building
of proxies which include AspectJ aspects (code style as well
Java 5 annotation style).
- 从以下版本开始:
- 4.0
- 作者:
- Rob Harrop, Juergen Hoeller, Ramnivas Laddad
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明private static final ConcurrentHashMap<Class<?>,Object> Cache for singleton aspect instances.private final AspectJAdvisorFactoryprivate static final long从类继承的字段 infra.aop.framework.AdvisedSupport
EMPTY_TARGET_SOURCE -
构造器概要
构造器构造器说明Create a new AspectJProxyFactory.AspectJProxyFactory(Class<?>... interfaces) Create a newAspectJProxyFactory.AspectJProxyFactory(Object target) Create a new AspectJProxyFactory. -
方法概要
修饰符和类型方法说明private voidaddAdvisorsFromAspectInstanceFactory(MetadataAwareAspectInstanceFactory instanceFactory) Add allAdvisorsfrom the suppliedMetadataAwareAspectInstanceFactoryto the current chain.voidAdd an aspect of the supplied type to the end of the advice chain.voidAdd the supplied aspect instance to the chain.createAspectInstanceFactory(AspectMetadata am, Class<?> aspectClass, String aspectName) Create aMetadataAwareAspectInstanceFactoryfor the supplied aspect type.private AspectMetadatacreateAspectMetadata(Class<?> aspectClass, String aspectName) Create anAspectMetadatainstance for the supplied aspect type.<T> TgetProxy()Create a new proxy according to the settings in this factory.<T> TgetProxy(ClassLoader classLoader) Create a new proxy according to the settings in this factory.private ObjectgetSingletonAspectInstance(Class<?> aspectClass) Get the singleton aspect instance for the supplied aspect type.从类继承的方法 infra.aop.framework.ProxyCreatorSupport
addListener, adviceChanged, createAopProxy, getAopProxyFactory, isActive, removeListener, setAopProxyFactory从类继承的方法 infra.aop.framework.AdvisedSupport
addAdvice, addAdvice, addAdvisor, addAdvisor, addAdvisors, addAdvisors, addInterface, adviceIncluded, copyConfigurationFrom, copyConfigurationFrom, countAdvicesOfType, getAdvisorCount, getAdvisors, getAdvisorsInternal, getInterceptorChainFactory, getInterceptors, getProxiedInterfaces, getTargetClass, getTargetSource, indexOf, indexOf, isInterfaceProxied, isPreFiltered, removeAdvice, removeAdvisor, removeAdvisor, removeInterface, replaceAdvisor, setInterceptorChainFactory, setInterfaces, setPreFiltered, setTarget, setTargetClass, setTargetSource, toProxyConfigString, toString从类继承的方法 infra.aop.framework.ProxyConfig
copyFrom, isExposeProxy, isFrozen, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setFrozen, setOpaque, setOptimize, setProxyTargetClass从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait从接口继承的方法 infra.aop.framework.Advised
isExposeProxy, isFrozen, isProxyTargetClass, setExposeProxy
-
字段详细资料
-
serialVersionUID
private static final long serialVersionUID- 另请参阅:
-
aspectCache
Cache for singleton aspect instances. -
aspectFactory
-
-
构造器详细资料
-
AspectJProxyFactory
public AspectJProxyFactory()Create a new AspectJProxyFactory. -
AspectJProxyFactory
Create a new AspectJProxyFactory.Will proxy all interfaces that the given target implements.
- 参数:
target- the target object to be proxied
-
AspectJProxyFactory
Create a newAspectJProxyFactory. No target, only interfaces. Must add interceptors.
-
-
方法详细资料
-
addAspect
Add the supplied aspect instance to the chain. The type of the aspect instance supplied must be a singleton aspect. True singleton lifecycle is not honoured when using this method - the caller is responsible for managing the lifecycle of any aspects added in this way.- 参数:
aspectInstance- the AspectJ aspect instance
-
addAspect
Add an aspect of the supplied type to the end of the advice chain.- 参数:
aspectClass- the AspectJ aspect class
-
addAdvisorsFromAspectInstanceFactory
private void addAdvisorsFromAspectInstanceFactory(MetadataAwareAspectInstanceFactory instanceFactory) Add allAdvisorsfrom the suppliedMetadataAwareAspectInstanceFactoryto the current chain. Exposes any special purposeAdvisorsif needed. -
createAspectMetadata
Create anAspectMetadatainstance for the supplied aspect type.- 抛出:
IllegalArgumentException- aspectClass is not an @AspectJ aspect
-
createAspectInstanceFactory
private MetadataAwareAspectInstanceFactory createAspectInstanceFactory(AspectMetadata am, Class<?> aspectClass, String aspectName) Create aMetadataAwareAspectInstanceFactoryfor the supplied aspect type. If the aspect type has no per clause, then aSingletonMetadataAwareAspectInstanceFactoryis returned, otherwise aPrototypeAspectInstanceFactoryis returned. -
getSingletonAspectInstance
Get the singleton aspect instance for the supplied aspect type. An instance is created if one cannot be found in the instance cache. -
getProxy
public <T> T getProxy()Create a new proxy according to the settings in this factory.Can be called repeatedly. Effect will vary if we've added or removed interfaces. Can add and remove interceptors.
Uses a default class loader: Usually, the thread context class loader (if necessary for proxy creation).
- 返回:
- the new proxy
-
getProxy
Create a new proxy according to the settings in this factory.Can be called repeatedly. Effect will vary if we've added or removed interfaces. Can add and remove interceptors.
Uses the given class loader (if necessary for proxy creation).
- 参数:
classLoader- the class loader to create the proxy with- 返回:
- the new proxy
-