Class ReflectionUtils

java.lang.Object
au.com.origin.snapshots.utils.ReflectionUtils

public class ReflectionUtils extends Object
  • Constructor Details

    • ReflectionUtils

      public ReflectionUtils()
  • Method Details

    • findFieldByPredicate

      public static Optional<Field> findFieldByPredicate(Class<?> clazz, Predicate<Field> predicate)
      Find Field by given predicate.

      Invoke the given predicate on all fields in the target class, going up the class hierarchy to get all declared fields.

      Parameters:
      clazz - the target class to analyze
      predicate - the predicate
      Returns:
      the field or empty optional
    • makeAccessible

      public static void makeAccessible(Field field)