类 AspectJProxyFactory

所有已实现的接口:
Advised, TargetClassAware, Serializable

public class AspectJProxyFactory extends ProxyCreatorSupport
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
另请参阅:
  • 字段详细资料

  • 构造器详细资料

    • AspectJProxyFactory

      public AspectJProxyFactory()
      Create a new AspectJProxyFactory.
    • AspectJProxyFactory

      public AspectJProxyFactory(Object target)
      Create a new AspectJProxyFactory.

      Will proxy all interfaces that the given target implements.

      参数:
      target - the target object to be proxied
    • AspectJProxyFactory

      public AspectJProxyFactory(Class<?>... interfaces)
      Create a new AspectJProxyFactory. No target, only interfaces. Must add interceptors.
  • 方法详细资料

    • addAspect

      public void addAspect(Object aspectInstance)
      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

      public void addAspect(Class<?> aspectClass)
      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 all Advisors from the supplied MetadataAwareAspectInstanceFactory to the current chain. Exposes any special purpose Advisors if needed.
      另请参阅:
    • createAspectMetadata

      private AspectMetadata createAspectMetadata(Class<?> aspectClass, String aspectName)
      Create an AspectMetadata instance for the supplied aspect type.
      抛出:
      IllegalArgumentException - aspectClass is not an @AspectJ aspect
    • createAspectInstanceFactory

      private MetadataAwareAspectInstanceFactory createAspectInstanceFactory(AspectMetadata am, Class<?> aspectClass, String aspectName)
      Create a MetadataAwareAspectInstanceFactory for the supplied aspect type. If the aspect type has no per clause, then a SingletonMetadataAwareAspectInstanceFactory is returned, otherwise a PrototypeAspectInstanceFactory is returned.
    • getSingletonAspectInstance

      private Object getSingletonAspectInstance(Class<?> aspectClass)
      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

      public <T> T getProxy(@Nullable ClassLoader classLoader)
      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