Class UReflectionOptions<T extends Member>

java.lang.Object
ushiosan.jvm.reflection.UReflectionOptions<T>

public class UReflectionOptions<T extends Member> extends Object
  • 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

      @Contract(" -> new") @NotNull public static @NotNull UReflectionOptions<Field> 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:
      true if you want to access only public elements or false otherwise
    • setPublicAccessOnly

      @NotNull public @NotNull UReflectionOptions<T> setPublicAccessOnly(boolean publicAccess)
      Changes the state of public access on the current instance.
      Parameters:
      publicAccess - true if you want to access only public elements or false otherwise
      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 to true and 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

      @NotNull public @NotNull UReflectionOptions<T> setMaxDeep(int maxDeep)
      Changes the state of deep recursive iterations on the current instance.
      Parameters:
      maxDeep - maximum iterations in recursive searches. If the value is 0 then 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

      @NotNull public @NotNull UReflectionOptions<T> setRecursive(boolean recursive)
      Changes the state of recursive property 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 skipAbstract property
    • setSkipAbstract

      @NotNull public @NotNull UReflectionOptions<T> setSkipAbstract(boolean skipAbstract)
      Changes the state of skipAbstract property 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

      @NotNull public @NotNull @Unmodifiable List<Predicate<T>> 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