org.jboss.aop.advice
Class GenericAspectFactory

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

public class GenericAspectFactory
extends AspectFactoryWithClassLoaderSupport

Version:
$Revision: 77480 $
Author:
Kabir Khan

Constructor Summary
GenericAspectFactory(String classname, Element element)
           
 
Method Summary
protected  void configureInstance(Object instance, Advisor advisor, InstanceAdvisor instanceAdvisor, Joinpoint jp)
           
 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.
 String getClassname()
           
 Class<?> getClazz()
          Deprecated. 
 Element getElement()
           
protected  String getInjectorName(String attributeName)
           
 String getName()
          The name that identifies the aspect in its domain.
protected  void injectAdvisor(Object instance, Advisor advisor, String attributeName)
           
protected  void injectInstanceAdvisor(Object instance, InstanceAdvisor instanceAdvisor, String attributeName)
           
protected  void injectJoinpoint(Object instance, Joinpoint jp, String attributeName)
           
protected  void setAttribute(Object instance, PropertyDescriptor[] descriptors, String attributeName, String attributeText)
           
 void setClassname(String classname)
           
 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

GenericAspectFactory

public GenericAspectFactory(String classname,
                            Element element)
Method Detail

getClassname

public String getClassname()

setClassname

public void setClassname(String classname)

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)

getClazz

@Deprecated
public Class<?> getClazz()
Deprecated. 


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

configureInstance

protected void configureInstance(Object instance,
                                 Advisor advisor,
                                 InstanceAdvisor instanceAdvisor,
                                 Joinpoint jp)

setAttribute

protected void setAttribute(Object instance,
                            PropertyDescriptor[] descriptors,
                            String attributeName,
                            String attributeText)

injectAdvisor

protected void injectAdvisor(Object instance,
                             Advisor advisor,
                             String attributeName)

injectJoinpoint

protected void injectJoinpoint(Object instance,
                               Joinpoint jp,
                               String attributeName)

injectInstanceAdvisor

protected void injectInstanceAdvisor(Object instance,
                                     InstanceAdvisor instanceAdvisor,
                                     String attributeName)

getInjectorName

protected String getInjectorName(String attributeName)


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