Package nl.pim16aap2.util.reflection
Class FieldFinder.FieldFinderInSource
java.lang.Object
nl.pim16aap2.util.reflection.FieldFinder.FieldFinderInSource
- Enclosing class:
FieldFinder
Represents the second step of the field finder, after the source class has been specified.
-
Method Summary
Modifier and TypeMethodDescriptionCreates a newFieldFinder.MultipleFieldsFinderto retrieve all fields of a given type.<T> FieldFinder.TypedFieldFinder<T> Creates a newFieldFinder.TypedFieldFinderto retrieve the field by its type.withAnnotations(Class<? extends Annotation>... annotations) Creates a newFieldFinder.MultipleFieldsFinderto retrieve all fields annotated with the provided annotations.Creates a newFieldFinder.NamedFieldFinderto retrieve the field by its name.
-
Method Details
-
withName
@CheckReturnValue @Contract(pure=true) public FieldFinder.NamedFieldFinder<?> withName(String... names) Creates a newFieldFinder.NamedFieldFinderto retrieve the field by its name.- Parameters:
names- The names of the field to look for.If multiple names are provided, the first field found will be returned.
- Returns:
- The new
FieldFinder.NamedFieldFinder.
-
ofType
@CheckReturnValue @Contract(pure=true) public <T> FieldFinder.TypedFieldFinder<T> ofType(Class<T> type) Creates a newFieldFinder.TypedFieldFinderto retrieve the field by its type.- Parameters:
type- The type of the field to look for.- Returns:
- The new
FieldFinder.TypedFieldFinder.
-
allOfType
@CheckReturnValue @Contract(pure=true) public FieldFinder.MultipleFieldsFinder allOfType(Class<?> type) Creates a newFieldFinder.MultipleFieldsFinderto retrieve all fields of a given type.- Parameters:
type- The type of the fields to look for.- Returns:
- The new
FieldFinder.MultipleFieldsFinder.
-
withAnnotations
@SafeVarargs @CheckReturnValue @Contract(pure=true) public final FieldFinder.MultipleFieldsFinder withAnnotations(Class<? extends Annotation>... annotations) Creates a newFieldFinder.MultipleFieldsFinderto retrieve all fields annotated with the provided annotations.- Parameters:
annotations- The type of the fields to look for.- Returns:
- The new
FieldFinder.MultipleFieldsFinder.
-