public final class MethodList extends java.lang.Object implements java.lang.Iterable<AnnotatedMethod>
Modifier and Type | Class and Description |
---|---|
static interface |
MethodList.Filter
Method list filter.
|
Modifier and Type | Field and Description |
---|---|
private AnnotatedMethod[] |
methods |
Constructor and Description |
---|
MethodList(AnnotatedMethod... methods)
Create new method list from the given array of
annotated methods . |
MethodList(java.lang.Class<?> c)
Create new method list for a class.
|
MethodList(java.lang.Class<?> c,
boolean declaredMethods)
Create new method list for a class.
|
MethodList(java.util.Collection<java.lang.reflect.Method> methods)
Create new method list from the given collection of methods.
|
MethodList(java.lang.reflect.Method... methods)
Create new method list from the given array of methods.
|
Modifier and Type | Method and Description |
---|---|
MethodList |
filter(MethodList.Filter filter)
Created a new method list containing only the methods supported by the
method list filter . |
private static java.util.List<java.lang.reflect.Method> |
getAllDeclaredMethods(java.lang.Class<?> c) |
private static java.util.List<java.lang.reflect.Method> |
getMethods(java.lang.Class<?> c) |
MethodList |
hasNumParams(int paramCount)
Get a new sub-list of methods containing all the methods from this method
list that have the specific number of parameters.
|
MethodList |
hasReturnType(java.lang.Class<?> returnType)
Get a new sub-list of methods containing all the methods from this method
list that declare the specified return type.
|
MethodList |
isNotPublic()
Get a new sub-list of methods containing all the methods from this method
list that are not public.
|
java.util.Iterator<AnnotatedMethod> |
iterator()
Iterator over the list of
annotated methods contained
in this method list. |
MethodList |
nameStartsWith(java.lang.String prefix)
Get a new sub-list of methods containing all the methods from this method
list with a specified method name prefix.
|
<T extends java.lang.annotation.Annotation> |
withAnnotation(java.lang.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 java.lang.annotation.Annotation> |
withMetaAnnotation(java.lang.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 java.lang.annotation.Annotation> |
withoutAnnotation(java.lang.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 java.lang.annotation.Annotation> |
withoutMetaAnnotation(java.lang.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.
|
private AnnotatedMethod[] methods
public MethodList(java.lang.Class<?> c)
all methods
available
on the class.
The bridge methods
and methods declared directly
on the Object
class are filtered out.c
- class from which the method list is created.public MethodList(java.lang.Class<?> c, boolean declaredMethods)
all methods
available
on the class or declared methods
only,
depending on the value of the declaredMethods
parameter.
The bridge methods
and methods declared directly
on the Object
class are filtered out.c
- class from which the method list is created.declaredMethods
- if true
only the declared methods
will be included in the method list; otherwise
all methods
will be listed.public MethodList(java.util.Collection<java.lang.reflect.Method> methods)
bridge methods
and methods declared directly
on the Object
class are filtered out.methods
- methods to be included in the method list.public MethodList(java.lang.reflect.Method... methods)
bridge methods
and methods declared directly
on the Object
class are filtered out.methods
- methods to be included in the method list.public MethodList(AnnotatedMethod... methods)
annotated methods
.methods
- methods to be included in the method list.private static java.util.List<java.lang.reflect.Method> getAllDeclaredMethods(java.lang.Class<?> c)
private static java.util.List<java.lang.reflect.Method> getMethods(java.lang.Class<?> c)
public java.util.Iterator<AnnotatedMethod> iterator()
annotated methods
contained
in this method list.iterator
in interface java.lang.Iterable<AnnotatedMethod>
public MethodList isNotPublic()
public MethodList hasNumParams(int paramCount)
paramCount
- number of method parameters.public MethodList hasReturnType(java.lang.Class<?> returnType)
returnType
- method return type.public MethodList nameStartsWith(java.lang.String prefix)
prefix
- method name prefix.public <T extends java.lang.annotation.Annotation> MethodList withAnnotation(java.lang.Class<T> annotation)
T
- annotation type.annotation
- annotation class.public <T extends java.lang.annotation.Annotation> MethodList withMetaAnnotation(java.lang.Class<T> annotation)
T
- meta-annotation type.annotation
- meta-annotation class.public <T extends java.lang.annotation.Annotation> MethodList withoutAnnotation(java.lang.Class<T> annotation)
T
- annotation type.annotation
- annotation class.public <T extends java.lang.annotation.Annotation> MethodList withoutMetaAnnotation(java.lang.Class<T> annotation)
T
- meta-annotation type.annotation
- meta-annotation class.public MethodList filter(MethodList.Filter filter)
method list filter
.filter
- method list filter.