Class FieldPredicates
-
- All Implemented Interfaces:
public class FieldPredicates
Common predicates to identify fields. Usually used in combination to define a field in an object graph. For example:
Predicate<Field> predicate = named("name").and(ofType(String.class)).and(inClass(Person.class));
Mahmoud Ben Hassine ([email protected])
-
-
Constructor Summary
Constructors Constructor Description FieldPredicates()
-
Method Summary
Modifier and Type Method Description static Predicate<Field>
named(String name)
Create a predicate to check that a field has a certain name pattern. static Predicate<Field>
ofType(Class<out Object> type)
Create a predicate to check that a field has a certain type. static Predicate<Field>
inClass(Class<out Object> clazz)
Create a predicate to check that a field is defined in a given class. static Predicate<Field>
isAnnotatedWith(Array<Class<out Annotation>> annotations)
Create a predicate to check that a field is annotated with one of the given annotations. static Predicate<Field>
hasModifiers(Integer modifiers)
Create a predicate to check that a field has a given set of modifiers. -
-
Method Detail
-
named
static Predicate<Field> named(String name)
Create a predicate to check that a field has a certain name pattern.
- Parameters:
name
- pattern of the field name to check- Returns:
Predicate to check that a field has a certain name pattern
-
ofType
static Predicate<Field> ofType(Class<out Object> type)
Create a predicate to check that a field has a certain type.
- Parameters:
type
- of the field to check- Returns:
Predicate to check that a field has a certain type
-
inClass
static Predicate<Field> inClass(Class<out Object> clazz)
Create a predicate to check that a field is defined in a given class.
- Parameters:
clazz
- enclosing type of the field to check- Returns:
Predicate to check that a field is defined in a given class.
-
isAnnotatedWith
static Predicate<Field> isAnnotatedWith(Array<Class<out Annotation>> annotations)
Create a predicate to check that a field is annotated with one of the given annotations.
- Parameters:
annotations
- present on the field- Returns:
Predicate to check that a field is annotated with one of the given annotations.
-
hasModifiers
static Predicate<Field> hasModifiers(Integer modifiers)
Create a predicate to check that a field has a given set of modifiers.
- Parameters:
modifiers
- of the field to check- Returns:
Predicate to check that a field has a given set of modifiers
-
-
-
-