org.jboss.aop.advice
Class AspectFactoryDelegator

java.lang.Object
  extended by org.jboss.aop.advice.AspectFactoryWithClassLoaderSupport
      extended by org.jboss.aop.advice.AspectFactoryDelegator
All Implemented Interfaces:
AspectFactory, AspectFactoryWithClassLoader

public class AspectFactoryDelegator
extends AspectFactoryWithClassLoaderSupport

Lazy loading of AspectFactory

Version:
$Revision: 70830 $
Author:
Bill Burke

Constructor Summary
AspectFactoryDelegator(String factory, Element element)
           
 
Method Summary
 Object createPerClass(Advisor advisor)
          Creates an aspect with scope value Scope.PER_CLASS.
 Object createPerInstance(Advisor advisor, InstanceAdvisor instanceAdvisor)
          Creates an aspect with scope value Scope.PER_INSTANCE.
 Object createPerJoinpoint(Advisor advisor, InstanceAdvisor instanceAdvisor, Joinpoint jp)
          Creates an aspect with scope value or Scope.PER_JOINPOINT.
 Object createPerJoinpoint(Advisor advisor, Joinpoint jp)
          Creates an aspect with scope value Scope.PER_CLASS_JOINPOINT or Scope.PER_JOINPOINT.
 Object createPerVM()
          Creates an aspect with scope value Scope.PER_VM.
 Element getElement()
           
 AspectFactory getFactory()
           
 String getName()
          The name that identifies the aspect in its domain.
 void setElement(Element element)
           
 
Methods inherited from class org.jboss.aop.advice.AspectFactoryWithClassLoaderSupport
getLoader, loadClass, peekScopedClassLoader, popScopedClassLoader, pushScopedClassLoader, setClassLoader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AspectFactoryDelegator

public AspectFactoryDelegator(String factory,
                              Element element)
Method Detail

getName

public String getName()
Description copied from interface: AspectFactory
The name that identifies the aspect in its domain. Typically, the name is the name of the class.

Returns:
the name that identifies the aspect in its domain.
See Also:
Domain

getElement

public Element getElement()

setElement

public void setElement(Element element)

getFactory

public AspectFactory getFactory()

createPerVM

public Object createPerVM()
Description copied from interface: AspectFactory
Creates an aspect with scope value Scope.PER_VM.

Returns:
the single aspect instance that will be invoked for all applicable joinpoints during Java VM execution. If null, the aspect represented by this factory is ignored, resulting in no interception.

createPerClass

public Object createPerClass(Advisor advisor)
Description copied from interface: AspectFactory
Creates an aspect with scope value Scope.PER_CLASS.

Parameters:
advisor - manages all the interceptions that should occur during execution of a specific class
Returns:
the aspect instance that will be invoked for all applicable joinpoints contained in the class managed by advisor. If null, the aspect represented by this factory is ignored, resulting in no interception of the joinpoints contained in the referred class.
See Also:
Advisor.getClazz()

createPerInstance

public Object createPerInstance(Advisor advisor,
                                InstanceAdvisor instanceAdvisor)
Description copied from interface: AspectFactory
Creates an aspect with scope value Scope.PER_INSTANCE.

Parameters:
advisor - manages all the interceptions that should occur during execution of a specific class
instanceAdvisor - manages all the interceptions that should occur during execution of a specific instance. The instance it manages is an object of the class managed by advisor
Returns:
the aspect instance that will be invoked for all applicable joinpoints contained in the instance managed by instanceAdvisor. If null, the aspect represented by this factory is ignored, resulting in no interception of the joinpoints contained in the referred instance.
See Also:
Advisor.getClazz(), InstanceAdvisor.getInstance()

createPerJoinpoint

public Object createPerJoinpoint(Advisor advisor,
                                 Joinpoint jp)
Description copied from interface: AspectFactory
Creates an aspect with scope value Scope.PER_CLASS_JOINPOINT or Scope.PER_JOINPOINT.
In case the scope value is PER_CLASS_JOINPOINT, this method will always be invoked to create the aspect instance. On the other hand, if the scope value is PER_JOINPOINT, this method is called only if the joinpoint to be intercepted is in a static context (like a static method, a static field access, or a constructor execution).

Parameters:
advisor - manages all the interceptions that should occur during execution of a specific class
jp - the joinpoint to be intercepted by the created instance. This joinpoint is contained in the class managed by advisor
Returns:
the aspect instance that will be invoked only to intercept jp. If null, the aspect represented by this factory is ignored, resulting in no interception of jp.
See Also:
Advisor.getClazz(), Joinpoint

createPerJoinpoint

public Object createPerJoinpoint(Advisor advisor,
                                 InstanceAdvisor instanceAdvisor,
                                 Joinpoint jp)
Description copied from interface: AspectFactory
Creates an aspect with scope value or Scope.PER_JOINPOINT.
This method is called only if the joinpoint to be intercepted is not in a static context (like a non-static method, for example).

Parameters:
advisor - manages all the interceptions that should occur during execution of a specific class
instanceAdvisor - manages all the interceptions that should occur during execution of a specific instance. The instance it manages is an object of the class managed by advisor
jp - the joinpoint to be intercepted by the created instance. This joinpoint is contained in the class managed by advisor
Returns:
the aspect instance that will be invoked only to intercept jp when it happens on the instance managed by instanceAdvisor. If null, the aspect represented by this factory is ignored, resulting in no interception of jp when it is executed in the context of the referred instance.
See Also:
Advisor.getClazz(), InstanceAdvisor.getInstance(), Joinpoint


Copyright © 2008 JBoss, a division of Red Hat, Inc.. All Rights Reserved.