Class ReflectUtils

java.lang.Object
com.igormaznitsa.jbbp.utils.ReflectUtils

public final class ReflectUtils extends Object
Auxiliary class collects methods for work with reflection.
Since:
1.4.0
  • Method Details

    • isPotentiallyAccessibleClass

      public static boolean isPotentiallyAccessibleClass(Class<?> klazz)
    • isPotentiallyAccessibleField

      public static boolean isPotentiallyAccessibleField(Field field)
    • makeAccessible

      public static <T extends AccessibleObject> T makeAccessible(T obj)
      Make accessible an accessible object, AccessController.doPrivileged will be called.
      Type Parameters:
      T - type of object
      Parameters:
      obj - an object to make accessible, it can be null.
      Returns:
      the same object
      See Also:
    • newInstance

      public static <T> T newInstance(Class<T> klazz)
      Create class instance through default constructor call
      Type Parameters:
      T - type of the class
      Parameters:
      klazz - class to be instantiated, must not be null
      Returns:
      instance of class, must not be null
      Throws:
      RuntimeException - if can't create instance for an error