public class MethodPredicates
extends java.lang.Object
Method
objects.Modifier and Type | Method and Description |
---|---|
static java.util.function.Predicate<java.lang.reflect.Method> |
annotated() |
static java.util.function.Predicate<java.lang.reflect.Method> |
annotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType) |
static java.util.function.Predicate<java.lang.reflect.Method> |
getter()
A predicate that returns
true if the evaluated method is a getter
method. |
static java.util.function.Predicate<java.lang.reflect.Method> |
getterOf(java.lang.reflect.Field field) |
static java.util.function.Predicate<java.lang.reflect.Method> |
getterOf(java.lang.String propertyName) |
static java.util.function.Predicate<java.lang.reflect.Method> |
returns(java.lang.Class returnType) |
static java.util.function.Predicate<java.lang.reflect.Method> |
setter()
A predicate that returns
true if the evaluated method is a
setter method. |
static java.util.function.Predicate<java.lang.reflect.Method> |
setterOf(java.lang.reflect.Field field) |
static java.util.function.Predicate<java.lang.reflect.Method> |
setterOf(java.lang.String propertyName) |
static java.util.function.Predicate<java.lang.reflect.Method> |
withoutParameters()
Returns a predicate that evaluates to
true if a method takes
no parameter. |
static java.util.function.Predicate<java.lang.reflect.Method> |
withParameters(java.lang.Class... parameterTypes)
Returns a predicate that evaluates to
true if the parameter
types of a method equals the given types. |
public static final java.util.function.Predicate<java.lang.reflect.Method> getter()
true
if the evaluated method is a getter
method.
The method may have a prefix "get" or "is", take no parameter and return an object. If the method has the prefix "is", then it must return a boolean value.
public static final java.util.function.Predicate<java.lang.reflect.Method> setter()
true
if the evaluated method is a
setter method.
The method must have the "set" prefix, take one parameter and return no value (a void method).
public static java.util.function.Predicate<java.lang.reflect.Method> getterOf(java.lang.String propertyName)
true
if a method is a getter
method for the specified property name.public static java.util.function.Predicate<java.lang.reflect.Method> setterOf(java.lang.String propertyName)
true
if a method is a setter
method for the specified property name.public static java.util.function.Predicate<java.lang.reflect.Method> getterOf(java.lang.reflect.Field field)
public static java.util.function.Predicate<java.lang.reflect.Method> setterOf(java.lang.reflect.Field field)
public static java.util.function.Predicate<java.lang.reflect.Method> withParameters(java.lang.Class... parameterTypes)
true
if the parameter
types of a method equals the given types.parameterTypes
- the parameter typespublic static java.util.function.Predicate<java.lang.reflect.Method> withoutParameters()
true
if a method takes
no parameter.public static java.util.function.Predicate<java.lang.reflect.Method> returns(java.lang.Class returnType)
true
if the evaluated method
has the specified type as the return type.public static final java.util.function.Predicate<java.lang.reflect.Method> annotated()
true
if the method has
annotations.public static java.util.function.Predicate<java.lang.reflect.Method> annotatedWith(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
true
if the evaluated element
is annotated with the specified Annotation.