Class AnnotatedMethod
- 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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <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).Stream<Annotation>
annotationsWithMetaAnnotation(Class<? extends Annotation> type)
Get all instances of annotations annotated with the specified meta-annotation.static AnnotatedMethod
create(Method method)
Create anAnnotatedMethod
instance from aJava method
.Method
declaredMethod()
Get the declared Java method.<T extends Annotation>
TfirstAnnotationOrMetaAnnotation(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[]
genericParameterTypes()
Get generic method parameter types.Type
genericReturnType()
Get generic method return type.<T extends Annotation>
TgetAnnotation(Class<T> annotationType)
Annotation[]
getAnnotations()
Annotation[]
getDeclaredAnnotations()
<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).Method
method()
Get the underlying Java method.Annotation[][]
parameterAnnotations()
Get method parameter annotations.Class<?>[]
parameterTypes()
Get method parameter types.Class<?>
returnType()
Get method return type.String
toString()
TypeVariable<Method>[]
typeParameters()
Get method type parameters.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.reflect.AnnotatedElement
getAnnotationsByType, getDeclaredAnnotation, getDeclaredAnnotationsByType, isAnnotationPresent
-
-
-
-
Method Detail
-
create
public static AnnotatedMethod create(Method method)
Create anAnnotatedMethod
instance from aJava 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
GrpcMethod
, which may be the same as or overridden by the method returned bydeclaredMethod()
.- 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 alsoMethod.getParameterTypes()
.- Returns:
- method parameter types.
-
typeParameters
public TypeVariable<Method>[] typeParameters()
Get method type parameters. See alsoMethod.getTypeParameters()
.- Returns:
- method type parameters.
-
genericParameterTypes
public Type[] genericParameterTypes()
Get generic method parameter types. See alsoMethod.getGenericParameterTypes()
.- Returns:
- generic method parameter types.
-
genericReturnType
public Type genericReturnType()
Get generic method return type. See alsoMethod.getGenericReturnType()
()}.- Returns:
- generic method return types.
-
returnType
public Class<?> returnType()
Get method return type. See alsoMethod.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 interfaceAnnotatedElement
-
getAnnotations
public Annotation[] getAnnotations()
- Specified by:
getAnnotations
in interfaceAnnotatedElement
-
getDeclaredAnnotations
public Annotation[] getDeclaredAnnotations()
- Specified by:
getDeclaredAnnotations
in interfaceAnnotatedElement
-
-