Class EnumValuesFinder
java.lang.Object
nl.pim16aap2.util.reflection.ReflectionFinder<Object[], EnumValuesFinder>
nl.pim16aap2.util.reflection.EnumValuesFinder
Represents a
ReflectionFinder for enum values.
This class can be used to retrieve enum values.
Calls should be chained, as the instance can change between invocations of some methods.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classFactory forEnumValuesFinderobjects.static final classRepresents an implementation ofReflectionFinderto retrieve an enum value by its index.static final classRepresents an implementation ofReflectionFinderto retrieve an enum value by its name.Nested classes/interfaces inherited from class ReflectionFinder
ReflectionFinder.ReflectionFinderWithParameters<T,U> -
Field Summary
Fields inherited from class ReflectionFinder
modifiers -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionatIndex(int index) Creates a newEnumValuesFinder.IndexedEnumValueFinderto retrieve the enum value by its index.Object[]get()Retrieves the target reflection object(s) using the current configuration.Object[]Retrieves the target reflection object(s) using the current configuration.Creates a newEnumValuesFinder.NamedEnumValueFinderto retrieve the enum value by its name.Methods inherited from class ReflectionFinder
addModifiers, withModifiers
-
Constructor Details
-
EnumValuesFinder
-
-
Method Details
-
withName
@CheckReturnValue @Contract(pure=true) public EnumValuesFinder.NamedEnumValueFinder withName(String name) Creates a newEnumValuesFinder.NamedEnumValueFinderto retrieve the enum value by its name.- Parameters:
name- The name of the enum value to look for.- Returns:
- The new
EnumValuesFinder.NamedEnumValueFinder.
-
atIndex
@CheckReturnValue @Contract(pure=true) public EnumValuesFinder.IndexedEnumValueFinder atIndex(int index) Creates a newEnumValuesFinder.IndexedEnumValueFinderto retrieve the enum value by its index.- Parameters:
index- The index of the enum value to look for.- Returns:
- The new
EnumValuesFinder.IndexedEnumValueFinder.
-
get
Retrieves the target reflection object(s) using the current configuration.This may throw an exception if the lookup hasn't been configured yet.
- Specified by:
getin classReflectionFinder<Object[], EnumValuesFinder>- Returns:
- The target reflection object(s) being searched for.
- Throws:
IllegalStateException- When the source class is not an enum.
-
getNullable
Retrieves the target reflection object(s) using the current configuration.This may throw an exception if the lookup hasn't been configured yet.
- Specified by:
getNullablein classReflectionFinder<Object[], EnumValuesFinder>- Returns:
- The target reflection object(s) being searched for or null if no object(s) could be found.
- Throws:
IllegalStateException- When the source class is not an enum.
-