Class DefaultProxyInvocation

java.lang.Object
me.ehp246.aufjms.core.reflection.DefaultProxyInvocation
All Implemented Interfaces:
Invocation

public final class DefaultProxyInvocation extends Object implements Invocation
Since:
1.0
Author:
Lei Yang
  • Constructor Details

    • DefaultProxyInvocation

      public DefaultProxyInvocation(Class<?> declaringType, Object target, Method method, List<?> args)
  • Method Details

    • declaringType

      public Class<?> declaringType()
    • target

      public Object target()
      Description copied from interface: Invocation
      The object on which the invocation is made.
      Specified by:
      target in interface Invocation
    • method

      public Method method()
      Description copied from interface: Invocation
      The method that is invoked.
      Specified by:
      method in interface Invocation
    • getMethodDeclaredAnnotations

      public List<? extends Annotation> getMethodDeclaredAnnotations()
    • getDeclaringClass

      public Class<?> getDeclaringClass()
    • getDeclaringClassSimpleName

      public String getDeclaringClassSimpleName()
    • args

      public List<?> args()
      Description copied from interface: Invocation
      Arguments of the invocation.
      Specified by:
      args in interface Invocation
    • getReturnType

      public Class<?> getReturnType()
    • hasReturn

      public boolean hasReturn()
    • isAsync

      public boolean isAsync()
    • isSync

      public boolean isSync()
    • getThrows

      public List<Class<?>> getThrows()
      Void is considered a declared return.
      Returns:
    • canThrow

      public boolean canThrow(Class<?> type)
    • canReturn

      public boolean canReturn(Class<?> type)
    • filterPayloadArgs

      public List<?> filterPayloadArgs(Set<Class<? extends Annotation>> annotations)
    • findOnDeclaringClass

      public <A extends Annotation, V> Optional<A> findOnDeclaringClass(Class<A> annotationClass)
      Returns the value of the annotation or default if annotation is not found.
    • findArgumentsOfType

      public <R> List<R> findArgumentsOfType(Class<R> type)
      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, 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. Returns a map with the key provided by the key supplier function, the value the argument.
      Type Parameters:
      K - Key from the key supplier
      V - Argument object reference
      A - 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

      public <A extends Annotation> Optional<A> findOnMethod(Class<A> annotationClass)
    • findOnMethodUp

      public <A extends Annotation> Optional<A> findOnMethodUp(Class<A> annotationClass)
    • getMethodName

      public String getMethodName()