Class ReflectionUtils


  • public class ReflectionUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      ReflectionUtils()  
    • Method Summary

      Modifier and Type Method Description
      static java.lang.reflect.Field getDeclaredField​(java.lang.Object object, java.lang.String fieldName)
      Find DeclaredField recursively.
      static <T> T getField​(java.lang.Object object, java.lang.String fieldName)
      Read field value directly, ignore private/protected and getter
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ReflectionUtils

        public ReflectionUtils()
    • Method Detail

      • getDeclaredField

        public static java.lang.reflect.Field getDeclaredField​(java.lang.Object object,
                                                               java.lang.String fieldName)
        Find DeclaredField recursively.
        Parameters:
        object - : the child object
        fieldName - : the field name in the parent object
        Returns:
        the field object in the parent object
      • getField

        public static <T> T getField​(java.lang.Object object,
                                     java.lang.String fieldName)
        Read field value directly, ignore private/protected and getter
        Parameters:
        object - : the child object
        fieldName - : the field name in the parent object
        Returns:
        : the field value in the parent object