org.aopalliance.aop.Advice classes
wrapping an AspectJ aspect or an AspectJ-annotated advice method.
| Modifier and Type | Class and Description |
|---|---|
| private static class | AbstractAspectJAdvice.
MethodMatcher that excludes the specified advice method. |
| Modifier and Type | Field and Description |
|---|---|
| private Map | |
| private String[] | argumentNames
This will be non-null if the creator of this advice object knows the argument names and sets them explicitly. |
| private boolean | |
| private final AspectInstanceFactory | |
| protected transient Method | |
| private String | aspectName
The name of the aspect (ref bean) in which this advice was defined (used when determining advice precedence so that we can determine whether two pieces of advice come from the same aspect). |
| private int | declarationOrder
The order of declaration of this advice within the aspect. |
| private final Class | |
| private Type | |
| private Class | |
| private Class | |
| protected static final String | JOIN_POINT_KEY
Key used in ReflectiveMethodInvocation userAttributes map for the current joinpoint. |
| private int | joinPointArgumentIndex
Index for thisJoinPoint argument (currently only supported at index 0 if present at all). |
| private int | joinPointStaticPartArgumentIndex
Index for thisJoinPointStaticPart argument (currently only supported at index 0 if present at all). |
| private final String | |
| private final Class | |
| private final AspectJExpressionPointcut | |
| private String | returningName
Non-null if after returning advice binds the return value. |
| private String | throwingName
Non-null if after throwing advice binds the thrown value. |
| Access | Constructor and Description |
|---|---|
| public | AbstractAspectJAdvice(Method
the AspectJ-style advice method aspectJAdviceMethod, AspectJExpressionPointcut the AspectJ expression pointcut pointcut, AspectInstanceFactory the factory for aspect instances aspectInstanceFactory)Create a new AbstractAspectJAdvice for the given advice method. |
| Modifier and Type | Method and Description |
|---|---|
| protected Object[] | Returns: the empty array if there are no argumentsthe current JoinPoint jp, JoinPointMatch the join point match that matched this execution join point jpMatch, Object the return value from the method execution (may be null) returnValue, Throwable the exception thrown by the method execution (may be null) ex)Take the arguments at the method execution join point and output a set of arguments to the advice method. |
| private void | |
| private void | |
| public final Pointcut | Returns: a composable pointcut that builds on the original AspectJ expression pointcutBuild a 'safe' pointcut that excludes the AspectJ advice method itself. |
| public final void | calculateArgumentBindings()
Do as much work as we can as part of the set-up so that argument binding on subsequent advice invocations can be as fast as possible. |
| private void | configurePointcutParameters(String[] argumentNames, int argumentIndexOffset)
All parameters from argumentIndexOffset onwards are candidates for pointcut parameters - but returning and throwing vars are handled differently and must be removed from the list if present. |
| protected ParameterNameDiscoverer | |
| public static JoinPoint | Returns: current AspectJ joinpoint, or through an exception if we're not in a Spring AOP invocation.Lazily instantiate joinpoint for the current invocation. |
| public final ClassLoader | |
| public final AspectInstanceFactory | |
| public final Method | |
| public String | getAspectName()
Implements org. Return the name of the aspect (bean) in which the advice was declared. |
| public int | getDeclarationOrder()
Implements org. Return the declaration order of the advice member within the aspect. |
| protected Type | |
| protected Class | |
| protected Class | |
| protected JoinPoint | |
| protected JoinPointMatch | |
| protected JoinPointMatch | |
| public int | |
| public final AspectJExpressionPointcut | |
| protected Object | Returns: the invocation resultthe JoinPointMatch that matched this execution join point jpMatch, Object the return value from the method execution (may be null) returnValue, Throwable the exception thrown by the method execution (may be null) ex)Invoke the advice method. |
| protected Object | |
| protected Object | |
| private static boolean | |
| private boolean | |
| private boolean | |
| private boolean | |
| private void | |
| public void | setArgumentNames(String
comma delimited list of argument names argumentNames)Set by the creator of this advice object if the argument names are known. |
| public void | setArgumentNamesFromStringArray(String...
list of argument names argumentNames)Set by the creator of this advice object if the argument names are known. |
| public void | |
| public void | |
| public void | |
| protected void | setReturningNameNoCheck(String name)
We need to hold the returning name at this level for argument binding calculations, this method allows the afterReturning advice subclass to set the name. |
| public void | |
| protected void | setThrowingNameNoCheck(String name)
We need to hold the throwing name at this level for argument binding calculations, this method allows the afterThrowing advice subclass to set the name. |
| protected boolean | |
| public String |
| argumentBindings | back to summary |
|---|---|
| private Map<String, Integer> argumentBindings
| |
| argumentNames | back to summary |
|---|---|
| private String[] argumentNames This will be non-null if the creator of this advice object knows the argument names and sets them explicitly. | |
| argumentsIntrospected | back to summary |
|---|---|
| private boolean argumentsIntrospected | |
| aspectInstanceFactory | back to summary |
|---|---|
| private final AspectInstanceFactory aspectInstanceFactory | |
| aspectJAdviceMethod | back to summary |
|---|---|
| protected transient Method aspectJAdviceMethod | |
| aspectName | back to summary |
|---|---|
| private String aspectName The name of the aspect (ref bean) in which this advice was defined (used when determining advice precedence so that we can determine whether two pieces of advice come from the same aspect). | |
| declarationOrder | back to summary |
|---|---|
| private int declarationOrder The order of declaration of this advice within the aspect. | |
| declaringClass | back to summary |
|---|---|
| private final Class<?> declaringClass | |
| discoveredReturningGenericType | back to summary |
|---|---|
| private Type discoveredReturningGenericType
| |
| discoveredReturningType | back to summary |
|---|---|
| private Class<?> discoveredReturningType | |
| discoveredThrowingType | back to summary |
|---|---|
| private Class<?> discoveredThrowingType | |
| JOIN_POINT_KEY | back to summary |
|---|---|
| protected static final String JOIN_POINT_KEY Key used in ReflectiveMethodInvocation userAttributes map for the current joinpoint. | |
| joinPointArgumentIndex | back to summary |
|---|---|
| private int joinPointArgumentIndex Index for thisJoinPoint argument (currently only supported at index 0 if present at all). | |
| joinPointStaticPartArgumentIndex | back to summary |
|---|---|
| private int joinPointStaticPartArgumentIndex Index for thisJoinPointStaticPart argument (currently only supported at index 0 if present at all). | |
| methodName | back to summary |
|---|---|
| private final String methodName | |
| parameterTypes | back to summary |
|---|---|
| private final Class<?>[] parameterTypes | |
| pointcut | back to summary |
|---|---|
| private final AspectJExpressionPointcut pointcut | |
| returningName | back to summary |
|---|---|
| private String returningName Non-null if after returning advice binds the return value. | |
| throwingName | back to summary |
|---|---|
| private String throwingName Non-null if after throwing advice binds the thrown value. | |
| AbstractAspectJAdvice | back to summary |
|---|---|
| public AbstractAspectJAdvice(Method aspectJAdviceMethod, AspectJExpressionPointcut pointcut, AspectInstanceFactory aspectInstanceFactory) Create a new AbstractAspectJAdvice for the given advice method.
| |
| argBinding | back to summary |
|---|---|
| protected Object[] argBinding(JoinPoint jp, JoinPointMatch jpMatch, Object returnValue, Throwable ex) Take the arguments at the method execution join point and output a set of arguments to the advice method.
| |
| bindArgumentsByName | back to summary |
|---|---|
| private void bindArgumentsByName(int numArgumentsExpectingToBind) | |
| bindExplicitArguments | back to summary |
|---|---|
| private void bindExplicitArguments(int numArgumentsLeftToBind) | |
| buildSafePointcut | back to summary |
|---|---|
| public final Pointcut buildSafePointcut() Build a 'safe' pointcut that excludes the AspectJ advice method itself.
| |
| calculateArgumentBindings | back to summary |
|---|---|
| public final void calculateArgumentBindings() Do as much work as we can as part of the set-up so that argument binding on subsequent advice invocations can be as fast as possible. If the first argument is of type JoinPoint or ProceedingJoinPoint then we pass a JoinPoint in that position (ProceedingJoinPoint for around advice). If the first argument is of type Remaining arguments have to be bound by pointcut evaluation at a given join point. We will get back a map from argument name to value. We need to calculate which advice parameter needs to be bound to which argument name. There are multiple strategies for determining this binding, which are arranged in a ChainOfResponsibility. | |
| configurePointcutParameters | back to summary |
|---|---|
| private void configurePointcutParameters(String[] argumentNames, int argumentIndexOffset) All parameters from argumentIndexOffset onwards are candidates for pointcut parameters - but returning and throwing vars are handled differently and must be removed from the list if present. | |
| createParameterNameDiscoverer | back to summary |
|---|---|
| protected ParameterNameDiscoverer createParameterNameDiscoverer() Create a ParameterNameDiscoverer to be used for argument binding. The default implementation creates a | |
| currentJoinPoint | back to summary |
|---|---|
| public static JoinPoint currentJoinPoint() Lazily instantiate joinpoint for the current invocation. Requires MethodInvocation to be bound with ExposeInvocationInterceptor. Do not use if access is available to the current ReflectiveMethodInvocation (in an around advice).
| |
| getAspectClassLoader | back to summary |
|---|---|
| public final ClassLoader getAspectClassLoader() Return the ClassLoader for aspect instances.
| |
| getAspectInstanceFactory | back to summary |
|---|---|
| public final AspectInstanceFactory getAspectInstanceFactory() Return the factory for aspect instances. | |
| getAspectJAdviceMethod | back to summary |
|---|---|
| public final Method getAspectJAdviceMethod() Return the AspectJ-style advice method. | |
| getAspectName | back to summary |
|---|---|
| public String getAspectName() Implements org. Doc from org. Return the name of the aspect (bean) in which the advice was declared.
| |
| getDeclarationOrder | back to summary |
|---|---|
| public int getDeclarationOrder() Implements org. Doc from org. Return the declaration order of the advice member within the aspect.
| |
| getDiscoveredReturningGenericType | back to summary |
|---|---|
protected Type getDiscoveredReturningGenericType()
| |
| getDiscoveredReturningType | back to summary |
|---|---|
| protected Class | |
| getDiscoveredThrowingType | back to summary |
|---|---|
| protected Class | |
| getJoinPoint | back to summary |
|---|---|
| protected JoinPoint getJoinPoint() Overridden in around advice to return proceeding join point. | |
| getJoinPointMatch | back to summary |
|---|---|
| protected JoinPointMatch getJoinPointMatch() Get the current join point match at the join point we are being dispatched on.
| |
| getJoinPointMatch | back to summary |
|---|---|
protected JoinPointMatch getJoinPointMatch(ProxyMethodInvocation pmi)
| |
| getOrder | back to summary |
|---|---|
| public int getOrder() Implements org. Doc from org. Get the order value of this object. Higher values are interpreted as lower priority. As a consequence,
the object with the lowest value has the highest priority (somewhat
analogous to Servlet Same order values will result in arbitrary sort positions for the affected objects.
| |
| getPointcut | back to summary |
|---|---|
| public final AspectJExpressionPointcut getPointcut() Return the AspectJ expression pointcut. | |
| invokeAdviceMethod | back to summary |
|---|---|
| protected Object invokeAdviceMethod(JoinPointMatch jpMatch, Object returnValue, Throwable ex) throws Throwable Invoke the advice method.
| |
| invokeAdviceMethod | back to summary |
|---|---|
| protected Object invokeAdviceMethod(JoinPoint jp, JoinPointMatch jpMatch, Object returnValue, Throwable t) throws Throwable | |
| invokeAdviceMethodWithGivenArgs | back to summary |
|---|---|
| protected Object invokeAdviceMethodWithGivenArgs(Object[] args) throws Throwable | |
| isVariableName | back to summary |
|---|---|
| private static boolean isVariableName(String name) | |
| maybeBindJoinPoint | back to summary |
|---|---|
| private boolean maybeBindJoinPoint(Class<?> candidateParameterType) | |
| maybeBindJoinPointStaticPart | back to summary |
|---|---|
| private boolean maybeBindJoinPointStaticPart(Class<?> candidateParameterType) | |
| maybeBindProceedingJoinPoint | back to summary |
|---|---|
| private boolean maybeBindProceedingJoinPoint(Class<?> candidateParameterType) | |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream inputStream) throws IOException, ClassNotFoundException | |
| setArgumentNames | back to summary |
|---|---|
| public void setArgumentNames(String argumentNames) Set by the creator of this advice object if the argument names are known. This could be for example because they have been explicitly specified in XML or in an advice annotation.
| |
| setArgumentNamesFromStringArray | back to summary |
|---|---|
| public void setArgumentNamesFromStringArray(String... argumentNames) Set by the creator of this advice object if the argument names are known. This could be for example because they have been explicitly specified in XML or in an advice annotation.
| |
| setAspectName | back to summary |
|---|---|
| public void setAspectName(String name) Set the name of the aspect (bean) in which the advice was declared. | |
| setDeclarationOrder | back to summary |
|---|---|
| public void setDeclarationOrder(int order) Set the declaration order of this advice within the aspect. | |
| setReturningName | back to summary |
|---|---|
| public void setReturningName(String name) | |
| setReturningNameNoCheck | back to summary |
|---|---|
| protected void setReturningNameNoCheck(String name) We need to hold the returning name at this level for argument binding calculations, this method allows the afterReturning advice subclass to set the name. | |
| setThrowingName | back to summary |
|---|---|
| public void setThrowingName(String name) | |
| setThrowingNameNoCheck | back to summary |
|---|---|
| protected void setThrowingNameNoCheck(String name) We need to hold the throwing name at this level for argument binding calculations, this method allows the afterThrowing advice subclass to set the name. | |
| supportsProceedingJoinPoint | back to summary |
|---|---|
| protected boolean supportsProceedingJoinPoint() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| Modifier and Type | Field and Description |
|---|---|
| private final Method |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. other)Overrides java. Indicates whether some other object is "equal to" this one. |
| public int | |
| public boolean | matches(Method
the candidate method method, Class<?> the target class targetClass)Implements org. Perform static checking to determine whether the given method matches. |
| public String |
| adviceMethod | back to summary |
|---|---|
| private final Method adviceMethod | |
| AdviceExcludingMethodMatcher | back to summary |
|---|---|
| public AdviceExcludingMethodMatcher(Method adviceMethod) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| matches | back to summary |
|---|---|
| public boolean matches(Method method, Class<?> targetClass) Implements org. Doc from org. Perform static checking to determine whether the given method matches. If this method returns | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |