Package com.ultikits.ultitools.aop
Class ReflectiveMethodInvocation
java.lang.Object
com.ultikits.ultitools.aop.ReflectiveMethodInvocation
- All Implemented Interfaces:
MethodInvocation
Implementation of
MethodInvocation that uses reflection to invoke methods.
Maintains an interceptor chain and invokes them in order before calling the target method.
- Since:
- 6.2.0
- Author:
- wisdomme
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Object[]private intprivate final List<MethodInterceptor> private final Methodprivate final Object -
Constructor Summary
ConstructorsConstructorDescriptionReflectiveMethodInvocation(Object target, Method method, Object[] arguments, List<MethodInterceptor> interceptors) Creates a new reflective method invocation. -
Method Summary
-
Field Details
-
target
-
method
-
arguments
-
interceptors
-
currentIndex
private int currentIndex
-
-
Constructor Details
-
ReflectiveMethodInvocation
public ReflectiveMethodInvocation(Object target, Method method, Object[] arguments, List<MethodInterceptor> interceptors) Creates a new reflective method invocation.- Parameters:
target- the target objectmethod- the method to invokearguments- the method argumentsinterceptors- the list of interceptors to apply
-
-
Method Details
-
getTarget
Description copied from interface:MethodInvocationGets the target object being invoked.- Specified by:
getTargetin interfaceMethodInvocation- Returns:
- the target object
-
getMethod
Description copied from interface:MethodInvocationGets the method being invoked.- Specified by:
getMethodin interfaceMethodInvocation- Returns:
- the method
-
getArguments
Description copied from interface:MethodInvocationGets the arguments passed to the method.- Specified by:
getArgumentsin interfaceMethodInvocation- Returns:
- the method arguments, or an empty array if no arguments
-
proceed
Description copied from interface:MethodInvocationProceeds with the next interceptor in the chain or invokes the target method if this is the last interceptor.- Specified by:
proceedin interfaceMethodInvocation- Returns:
- the result of the invocation
- Throws:
Throwable- if the invocation throws an exception
-