|
JBoss AOP Parent POM 2.2.2.GA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface AspectFactory
Creates aspect instances.
This interface must be implemented by all aspect factories. Declare aspect factories instead of the real aspect class when you want:
This interface provides different methods. However, only the one(s) correspondent
to the Scope
of the aspect will be called. Hence, when writing an aspect
factory whose scope is known (and is not intended to change), the implemention of
the other methods can be empty. However, we advise throwing a runtime exception
from those methods instead of simply returning null
, to alert for
unpredicted scenarios in case the Scope
value is not the expected.
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 . |
String |
getName()
The name that identifies the aspect in its domain. |
Method Detail |
---|
Object createPerVM()
Scope.PER_VM
.
null
, the aspect
represented by this factory is ignored, resulting in no interception.Object createPerClass(Advisor advisor)
Scope.PER_CLASS
.
advisor
- manages all the interceptions that should occur during execution
of a specific class
advisor
. If
null
, the aspect represented by this factory is ignored,
resulting in no interception of the joinpoints contained in the
referred class.Advisor.getClazz()
Object createPerInstance(Advisor advisor, InstanceAdvisor instanceAdvisor)
Scope.PER_INSTANCE
.
advisor
- manages all the interceptions that should occur during
execution of a specific classinstanceAdvisor
- 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
instanceAdvisor
. If null
, the aspect
represented by this factory is ignored, resulting in no
interception of the joinpoints contained in the referred
instance.Advisor.getClazz()
,
InstanceAdvisor.getInstance()
Object createPerJoinpoint(Advisor advisor, Joinpoint jp)
Scope.PER_CLASS_JOINPOINT
or
Scope.PER_JOINPOINT
.
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).
advisor
- manages all the interceptions that should occur during
execution of a specific classjp
- the joinpoint to be intercepted by the created instance.
This joinpoint is contained in the class managed by
advisor
jp
. If null
, the aspect represented by this
factory is ignored, resulting in no interception of jp
.Advisor.getClazz()
,
Joinpoint
Object createPerJoinpoint(Advisor advisor, InstanceAdvisor instanceAdvisor, Joinpoint jp)
Scope.PER_JOINPOINT
.
advisor
- manages all the interceptions that should occur
during execution of a specific classinstanceAdvisor
- 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
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.Advisor.getClazz()
,
InstanceAdvisor.getInstance()
,
Joinpoint
String getName()
Domain
|
JBoss AOP Parent POM 2.2.2.GA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |