接口 FieldUtils


  • public interface FieldUtils
    The utilities class for Java Reflection Field
    从以下版本开始:
    2.7.6
    • 方法详细资料

      • findField

        static Field findField​(Class<?> declaredClass,
                               String fieldName)
        Find the Field by the name in the specified class and its inherited types
        参数:
        declaredClass - the declared class
        fieldName - the name of Field
        返回:
        if can't be found, return null
      • findField

        static Field findField​(Object object,
                               String fieldName)
        Find the Field by the name in the specified class and its inherited types
        参数:
        object - the object whose field should be modified
        fieldName - the name of Field
        返回:
        if can't be found, return null
      • getFieldValue

        static Object getFieldValue​(Object object,
                                    String fieldName)
        Get the value of the specified Field
        参数:
        object - the object whose field should be modified
        fieldName - the name of Field
        返回:
        the value of the specified Field
      • getFieldValue

        static <T> T getFieldValue​(Object object,
                                   Field field)
        Get the value of the specified Field
        参数:
        object - the object whose field should be modified
        field - Field
        返回:
        the value of the specified Field
      • setFieldValue

        static <T> T setFieldValue​(Object object,
                                   String fieldName,
                                   T value)
        Set the value for the specified Field
        参数:
        object - the object whose field should be modified
        fieldName - the name of Field
        value - the value of field to be set
        返回:
        the previous value of the specified Field
      • setFieldValue

        static <T> T setFieldValue​(Object object,
                                   Field field,
                                   T value)
        Set the value for the specified Field
        参数:
        object - the object whose field should be modified
        field - Field
        value - the value of field to be set
        返回:
        the previous value of the specified Field