Package me.ehp246.aufjms.core.reflection
Class DefaultProxyInvocation
java.lang.Object
me.ehp246.aufjms.core.reflection.DefaultProxyInvocation
- All Implemented Interfaces:
Invocation
- Since:
- 1.0
- Author:
- Lei Yang
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultProxyInvocation(Class<?> declaringType, Object target, Method method, List<?> args) -
Method Summary
Modifier and TypeMethodDescriptionList<?>args()Arguments of the invocation.booleanboolean<A extends Annotation,V>
VclassAnnotationOf(Class<A> annotationClass, Function<A, V> mapper, Supplier<V> supplier) Class<?>List<?>filterPayloadArgs(Set<Class<? extends Annotation>> annotations) <R> List<R>findArgumentsOfType(Class<R> type) Find all arguments of the given parameter type.<A extends Annotation,V>
Optional<A>findOnDeclaringClass(Class<A> annotationClass) Returns the value of the annotation or default if annotation is not found.<A extends Annotation>
Optional<A>findOnMethod(Class<A> annotationClass) <A extends Annotation>
Optional<A>findOnMethodUp(Class<A> annotationClass) <A extends Annotation,V>
VfirstArgumentAnnotationOf(Class<A> annotationClass, Function<AnnotatedArgument<A>, V> mapper, Supplier<V> supplier) Class<?>List<? extends Annotation>Class<?>Void is considered a declared return.booleanbooleanisAsync()booleanisSync()<K,V, A extends Annotation>
Map<K,V> mapAnnotatedArguments(Class<A> annotationType, Function<A, K> keySupplier) Looks for arguments that are annotated by the given Annotation type.method()The method that is invoked.<A extends Annotation,V>
VmethodAnnotationOf(Class<A> annotationClass, Function<A, V> mapper, Supplier<V> supplier) <A extends Annotation,V>
Optional<V>optionalValueOnMethod(Class<A> annotationClass, Function<A, V> mapper) <A extends Annotation,V>
VresolveAnnotatedValue(Class<A> annotationClass, Function<AnnotatedArgument<A>, V> argMapper, Function<A, V> methodMapper, Function<A, V> classMapper, Supplier<V> supplier) Resolve the annotation value up the invocation hierarchy.<A extends Annotation>
Stream<AnnotatedArgument<A>>streamOfAnnotatedArguments(Class<A> annotationType) target()The object on which the invocation is made.
-
Constructor Details
-
DefaultProxyInvocation
-
-
Method Details
-
declaringType
-
target
Description copied from interface:InvocationThe object on which the invocation is made.- Specified by:
targetin interfaceInvocation
-
method
Description copied from interface:InvocationThe method that is invoked.- Specified by:
methodin interfaceInvocation
-
getMethodDeclaredAnnotations
-
getDeclaringClass
-
getDeclaringClassSimpleName
-
args
Description copied from interface:InvocationArguments of the invocation.- Specified by:
argsin interfaceInvocation
-
getReturnType
-
hasReturn
public boolean hasReturn() -
isAsync
public boolean isAsync() -
isSync
public boolean isSync() -
getThrows
Void is considered a declared return.- Returns:
-
canThrow
-
canReturn
-
filterPayloadArgs
-
findOnDeclaringClass
Returns the value of the annotation or default if annotation is not found. -
findArgumentsOfType
Find all arguments of the given parameter type.- Type Parameters:
R- Parameter type- Parameters:
type- Class of the parameter type- Returns:
- all arguments of the given type. Could have
null.
-
mapAnnotatedArguments
public <K,V, Map<K,A extends Annotation> V> mapAnnotatedArguments(Class<A> annotationType, Function<A, K> keySupplier) Looks for arguments that are annotated by the given Annotation type. Returns a map with the key provided by the key supplier function, the value the argument.- Type Parameters:
K- Key from the key supplierV- Argument object referenceA- Annotation type- Parameters:
annotationType-keySupplier-- Returns:
- returned Map can be modified. Never
null.
-
streamOfAnnotatedArguments
public <A extends Annotation> Stream<AnnotatedArgument<A>> streamOfAnnotatedArguments(Class<A> annotationType) -
optionalValueOnMethod
public <A extends Annotation,V> Optional<V> optionalValueOnMethod(Class<A> annotationClass, Function<A, V> mapper) -
firstArgumentAnnotationOf
public <A extends Annotation,V> V firstArgumentAnnotationOf(Class<A> annotationClass, Function<AnnotatedArgument<A>, V> mapper, Supplier<V> supplier) -
methodAnnotationOf
public <A extends Annotation,V> V methodAnnotationOf(Class<A> annotationClass, Function<A, V> mapper, Supplier<V> supplier) -
classAnnotationOf
public <A extends Annotation,V> V classAnnotationOf(Class<A> annotationClass, Function<A, V> mapper, Supplier<V> supplier) -
resolveAnnotatedValue
public <A extends Annotation,V> V resolveAnnotatedValue(Class<A> annotationClass, Function<AnnotatedArgument<A>, V> argMapper, Function<A, V> methodMapper, Function<A, V> classMapper, Supplier<V> supplier) Resolve the annotation value up the invocation hierarchy. -
findOnMethod
-
findOnMethodUp
-
getMethodName
-