Class AnnotatedMethodList
- java.lang.Object
-
- io.helidon.microprofile.grpc.core.AnnotatedMethodList
-
- All Implemented Interfaces:
Iterable<AnnotatedMethod>
public class AnnotatedMethodList extends Object implements Iterable<AnnotatedMethod>
Iterable list ofAnnotatedMethod
s on a single class with convenience getters to provide additional method information.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AnnotatedMethodList
create(Class<?> cls)
Create an annotated method list for a class.static AnnotatedMethodList
create(Class<?> cls, boolean declaredMethods)
Create an annotated method list for a class.static AnnotatedMethodList
create(Collection<Method> methods)
Create an annotated method list from the given collection of methods.AnnotatedMethodList
filter(Predicate<AnnotatedMethod> predicate)
Created a new method list containing only the methods supported by themethod list predicate
.AnnotatedMethodList
hasParameterCount(int paramCount)
Get a new sub-list of methods containing all the methods from this method list that have the specific number of parameters.AnnotatedMethodList
hasReturnType(Class<?> returnType)
Get a new sub-list of methods containing all the methods from this method list that declare the specified return type.AnnotatedMethodList
isNotPublic()
Get a new sub-list of methods containing all the methods from this method list that are not public.Iterator<AnnotatedMethod>
iterator()
Iterator over the list ofannotated methods
contained in this method list.AnnotatedMethodList
nameStartsWith(String prefix)
Get a new sub-list of methods containing all the methods from this method list with a specified method name prefix.Stream<AnnotatedMethod>
stream()
<T extends Annotation>
AnnotatedMethodListwithAnnotation(Class<T> annotation)
Get a new sub-list of methods containing all the methods from this method list with a specified method-level annotation declared.<T extends Annotation>
AnnotatedMethodListwithMetaAnnotation(Class<T> annotation)
Get a new sub-list of methods containing all the methods from this method list with a method-level annotation declared that is itself annotated with a specified meta-annotation.<T extends Annotation>
AnnotatedMethodListwithoutAnnotation(Class<T> annotation)
Get a new sub-list of methods containing all the methods from this method list without a specified method-level annotation declared.<T extends Annotation>
AnnotatedMethodListwithoutMetaAnnotation(Class<T> annotation)
Get a new sub-list of methods containing all the methods from this method list without any method-level annotation declared that would itself be annotated with a specified meta-annotation.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
create
public static AnnotatedMethodList create(Class<?> cls)
Create an annotated method list for a class.The method list contains
all methods
available on the class.The
bridge methods
and methods declared directly on theObject
class are filtered out.- Parameters:
cls
- class from which the method list is created- Returns:
- an
AnnotatedMethodList
containingAnnotatedMethod
instances for all of the methods of the specified class
-
create
public static AnnotatedMethodList create(Class<?> cls, boolean declaredMethods)
Create an annotated method list for a class.The method list contains
all methods
available on the class ordeclared methods
only, depending on the value of thedeclaredMethods
parameter.The
bridge methods
and methods declared directly on theObject
class are filtered out.- Parameters:
cls
- class from which the method list is createddeclaredMethods
- iftrue
only thedeclared methods
will be included in the method list; otherwiseall methods
will be listed- Returns:
- an
AnnotatedMethodList
containingAnnotatedMethod
instances for the methods of the specified class
-
create
public static AnnotatedMethodList create(Collection<Method> methods)
Create an annotated method list from the given collection of methods.The
bridge methods
and methods declared directly on theObject
class are filtered out.- Parameters:
methods
- methods to be included in the method list.- Returns:
- an
AnnotatedMethodList
containingAnnotatedMethod
instances for the methods of the specified class
-
iterator
public Iterator<AnnotatedMethod> iterator()
Iterator over the list ofannotated methods
contained in this method list.- Specified by:
iterator
in interfaceIterable<AnnotatedMethod>
- Returns:
- method list iterator.
-
isNotPublic
public AnnotatedMethodList isNotPublic()
Get a new sub-list of methods containing all the methods from this method list that are not public.- Returns:
- new filtered method sub-list.
-
hasParameterCount
public AnnotatedMethodList hasParameterCount(int paramCount)
Get a new sub-list of methods containing all the methods from this method list that have the specific number of parameters.- Parameters:
paramCount
- number of method parameters.- Returns:
- new filtered method sub-list.
-
hasReturnType
public AnnotatedMethodList hasReturnType(Class<?> returnType)
Get a new sub-list of methods containing all the methods from this method list that declare the specified return type.- Parameters:
returnType
- method return type.- Returns:
- new filtered method sub-list.
-
nameStartsWith
public AnnotatedMethodList nameStartsWith(String prefix)
Get a new sub-list of methods containing all the methods from this method list with a specified method name prefix.- Parameters:
prefix
- method name prefix.- Returns:
- new filtered method sub-list.
-
withAnnotation
public <T extends Annotation> AnnotatedMethodList withAnnotation(Class<T> annotation)
Get a new sub-list of methods containing all the methods from this method list with a specified method-level annotation declared.- Type Parameters:
T
- annotation type.- Parameters:
annotation
- annotation class.- Returns:
- new filtered method sub-list.
-
withMetaAnnotation
public <T extends Annotation> AnnotatedMethodList withMetaAnnotation(Class<T> annotation)
Get a new sub-list of methods containing all the methods from this method list with a method-level annotation declared that is itself annotated with a specified meta-annotation.- Type Parameters:
T
- meta-annotation type.- Parameters:
annotation
- meta-annotation class.- Returns:
- new filtered method sub-list.
-
withoutAnnotation
public <T extends Annotation> AnnotatedMethodList withoutAnnotation(Class<T> annotation)
Get a new sub-list of methods containing all the methods from this method list without a specified method-level annotation declared.- Type Parameters:
T
- annotation type.- Parameters:
annotation
- annotation class.- Returns:
- new filtered method sub-list.
-
withoutMetaAnnotation
public <T extends Annotation> AnnotatedMethodList withoutMetaAnnotation(Class<T> annotation)
Get a new sub-list of methods containing all the methods from this method list without any method-level annotation declared that would itself be annotated with a specified meta-annotation.- Type Parameters:
T
- meta-annotation type.- Parameters:
annotation
- meta-annotation class.- Returns:
- new filtered method sub-list.
-
stream
public Stream<AnnotatedMethod> stream()
- Returns:
- a
Stream
of theMethod
s in thisAnnotatedMethodList
-
filter
public AnnotatedMethodList filter(Predicate<AnnotatedMethod> predicate)
Created a new method list containing only the methods supported by themethod list predicate
.- Parameters:
predicate
- method list predicate.- Returns:
- new filtered method list.
-
-