public class Fields
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.function.Predicate<java.lang.reflect.Field> |
NO_FILTER
Filter which allows all fields.
|
static java.util.function.Predicate<java.lang.reflect.Field> |
NO_STATIC_TRANSIENT_OR_FINAL
Filter to exclude both static, transient and final fields.
|
Constructor and Description |
---|
Fields() |
Modifier and Type | Method and Description |
---|---|
static java.util.function.Predicate<java.lang.reflect.Field> |
excludeModifiers(int... modifiers)
Filter to exclude fields with the given modifiers.
|
static java.util.List<java.lang.reflect.Field> |
getAllFieldsWithFilter(java.lang.Class<?> clazz,
java.util.function.Predicate<java.lang.reflect.Field> filter)
Gets all the declared fields from a class and its subclasses, with the given filter applied to the fields.
|
static java.util.function.Predicate<java.lang.reflect.Field> |
getFieldsWithNames(java.lang.String... names)
Filter to include only fields with the given names.
|
public static final java.util.function.Predicate<java.lang.reflect.Field> NO_STATIC_TRANSIENT_OR_FINAL
public static final java.util.function.Predicate<java.lang.reflect.Field> NO_FILTER
public static java.util.function.Predicate<java.lang.reflect.Field> excludeModifiers(int... modifiers)
Modifier
for the available modifiers.modifiers
- The modifiers to exclude.public static java.util.function.Predicate<java.lang.reflect.Field> getFieldsWithNames(java.lang.String... names)
names
- The names of the fields to include.public static java.util.List<java.lang.reflect.Field> getAllFieldsWithFilter(java.lang.Class<?> clazz, java.util.function.Predicate<java.lang.reflect.Field> filter)
clazz
- The class to get all fields from.filter
- The filter to apply to exclude certain fields.