Module ushiosan.jvm.utilities
Package ushiosan.jvm.reflection
Class UReflectionOptions<T extends Member>
java.lang.Object
ushiosan.jvm.reflection.UReflectionOptions<T>
-
Method Summary
Modifier and TypeMethodDescriptionaddPredicate(@NotNull Predicate<T> predicate) Adds a new filter to the list of already registered filters.static <T extends Member>
@NotNull UReflectionOptions<T>generate()Generates a generic instance of options for use with reflectionstatic @NotNull UReflectionOptions<Field>Generates a field instance of options for use with reflectionstatic @NotNull UReflectionOptions<Method>Generates a method instance of options for use with reflectionintmaxDeep()User-defined maximum iterations.intUser-defined maximum iterations.List with all filters used to perform reflection operationsbooleanProperty used to check only public membersbooleanProperty used to identify members recursivelysetMaxDeep(int maxDeep) Changes the state of deep recursive iterations on the current instance.final @NotNull UReflectionOptions<T>setPredicates(Predicate<T> @NotNull ... predicates) Rewrites all the filters that were already registered.setPublicAccessOnly(boolean publicAccess) Changes the state of public access on the current instance.setRecursive(boolean recursive) Changes the state ofrecursiveproperty on the current instance.setSkipAbstract(boolean skipAbstract) Changes the state ofskipAbstractproperty on the current instance.booleanProperty used to exclude all abstract elements of an interface or abstract class
-
Method Details
-
generate
@Contract(" -> new") @NotNull public static <T extends Member> @NotNull UReflectionOptions<T> generate()Generates a generic instance of options for use with reflection- Type Parameters:
T- genetic member type- Returns:
- a generic instance of options
-
generateForMethods
@Contract(" -> new") @NotNull public static @NotNull UReflectionOptions<Method> generateForMethods()Generates a method instance of options for use with reflection- Returns:
- a method instance of options
-
generateForFields
Generates a field instance of options for use with reflection- Returns:
- a field instance of options
-
publicAccess
public boolean publicAccess()Property used to check only public members- Returns:
trueif you want to access only public elements orfalseotherwise
-
setPublicAccessOnly
Changes the state of public access on the current instance.- Parameters:
publicAccess-trueif you want to access only public elements orfalseotherwise- Returns:
- the same current instance
-
maxDeep
public int maxDeep()User-defined maximum iterations.This method does not take into account if the instance has the
recursive()property set totrueand will only return the raw value.- Returns:
- user-defined maximum iterations
-
maxDeepRecursive
public int maxDeepRecursive()User-defined maximum iterations.This method takes into account if the instance has the
recursive()property marked as true and will return a different value, depending on the value of said property.- Returns:
- user-defined maximum iterations
-
setMaxDeep
Changes the state of deep recursive iterations on the current instance.- Parameters:
maxDeep- maximum iterations in recursive searches. If the value is0then it is considered undefined recursive.- Returns:
- the same current instance
-
recursive
public boolean recursive()Property used to identify members recursively- Returns:
- user-defined recursive property
-
setRecursive
Changes the state ofrecursiveproperty on the current instance.- Parameters:
recursive- property used to handle recursive iterations in calls with reflection.- Returns:
- the same current instance
-
skipAbstract
public boolean skipAbstract()Property used to exclude all abstract elements of an interface or abstract class- Returns:
- user-defined
skipAbstractproperty
-
setSkipAbstract
Changes the state ofskipAbstractproperty on the current instance.- Parameters:
skipAbstract- property used to exclude all abstract elements of an interface or abstract class- Returns:
- the same current instance
-
predicates
List with all filters used to perform reflection operations- Returns:
- all predicate elements
-
addPredicate
@NotNull public @NotNull UReflectionOptions<T> addPredicate(@NotNull @NotNull Predicate<T> predicate) Adds a new filter to the list of already registered filters.- Parameters:
predicate- the new filter you want to add- Returns:
- the same current instance
-
setPredicates
@SafeVarargs @NotNull public final @NotNull UReflectionOptions<T> setPredicates(Predicate<T> @NotNull ... predicates) Rewrites all the filters that were already registered. Previous filters are lost once this method is called.- Parameters:
predicates- the new filters you want to add- Returns:
- the same current instance
-