java.lang.Object
io.helidon.microprofile.grpc.core.AnnotatedMethod
All Implemented Interfaces:
AnnotatedElement

public class AnnotatedMethod extends Object implements AnnotatedElement
A model of an annotated gRPC method.
  • Method Details

    • create

      public static AnnotatedMethod create(Method method)
      Create an AnnotatedMethod instance from a Java method.
      Parameters:
      method - the Java method
      Returns:
      an AnnotatedMethod instance representing the Java method
      Throws:
      NullPointerException - if the method parameter is null
    • method

      public Method method()
      Get the underlying Java method.

      This will be the method that is actually annotated with Grpc.GrpcMethod, which may be the same as or overridden by the method returned by declaredMethod().

      Returns:
      the actual annotated Java method.
    • declaredMethod

      public Method declaredMethod()
      Get the declared Java method.

      This method overrides, or is the same as, the one retrieved by method().

      Returns:
      the declared Java method.
    • parameterAnnotations

      public Annotation[][] parameterAnnotations()
      Get method parameter annotations.
      Returns:
      method parameter annotations.
    • parameterTypes

      public Class<?>[] parameterTypes()
      Get method parameter types.

      See also Method.getParameterTypes().

      Returns:
      method parameter types.
    • typeParameters

      public TypeVariable<Method>[] typeParameters()
      Get method type parameters.

      See also Method.getTypeParameters().

      Returns:
      method type parameters.
    • genericParameterTypes

      public Type[] genericParameterTypes()
      Get generic method parameter types.

      See also Method.getGenericParameterTypes().

      Returns:
      generic method parameter types.
    • genericReturnType

      public Type genericReturnType()
      Get generic method return type.

      See also Method.getGenericReturnType().

      Returns:
      generic method return types.
    • returnType

      public Class<?> returnType()
      Get method return type.

      See also Method.getReturnType().

      Returns:
      method return types.
    • metaMethodAnnotations

      public <T extends Annotation> Stream<T> metaMethodAnnotations(Class<T> annotation)
      Get all instances of the specified meta-annotation type found on the method annotations (a meta-annotation is an annotation that annotates other annotations).
      Type Parameters:
      T - meta-annotation type.
      Parameters:
      annotation - meta-annotation class to be searched for.
      Returns:
      meta-annotation instances of a given type annotating the method annotations.
    • firstAnnotationOrMetaAnnotation

      public <T extends Annotation> T firstAnnotationOrMetaAnnotation(Class<T> type)
      Get the first of the specified meta-annotation type found on the method annotations or on the method itself (a meta-annotation is an annotation that annotates other annotations).
      Type Parameters:
      T - meta-annotation type.
      Parameters:
      type - meta-annotation class to be searched for.
      Returns:
      meta-annotation instances of a given type annotating the method annotations
    • annotationOrMetaAnnotation

      public <T extends Annotation> Stream<T> annotationOrMetaAnnotation(Class<T> type)
      Get all instances of the specified meta-annotation type found on the method annotations or on the method itself (a meta-annotation is an annotation that annotates other annotations).
      Type Parameters:
      T - meta-annotation type.
      Parameters:
      type - meta-annotation class to be searched for.
      Returns:
      meta-annotation instances of a given type annotating the method annotations
    • annotationsWithMetaAnnotation

      public Stream<Annotation> annotationsWithMetaAnnotation(Class<? extends Annotation> type)
      Get all instances of annotations annotated with the specified meta-annotation.
      Parameters:
      type - meta-annotation class to be searched for.
      Returns:
      all instances of annotations annotated with the specified meta-annotation
    • getAnnotation

      public <T extends Annotation> T getAnnotation(Class<T> annotationType)
      Specified by:
      getAnnotation in interface AnnotatedElement
    • getAnnotations

      public Annotation[] getAnnotations()
      Specified by:
      getAnnotations in interface AnnotatedElement
    • getDeclaredAnnotations

      public Annotation[] getDeclaredAnnotations()
      Specified by:
      getDeclaredAnnotations in interface AnnotatedElement
    • toString

      public String toString()
      Overrides:
      toString in class Object