Interface FieldValueResolver.FieldWrapper

  • All Superinterfaces:
    java.lang.reflect.Member
    Enclosing class:
    FieldValueResolver

    public static interface FieldValueResolver.FieldWrapper
    extends java.lang.reflect.Member
    Workaround for accessing to the public attribute length of arrays.
    Since:
    0.12.0
    • Field Summary

      • Fields inherited from interface java.lang.reflect.Member

        DECLARED, PUBLIC
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.Object get​(java.lang.Object obj)
      Returns the value of the field represented by this Field, on the specified object.
      • Methods inherited from interface java.lang.reflect.Member

        getDeclaringClass, getModifiers, getName, isSynthetic
    • Method Detail

      • get

        java.lang.Object get​(java.lang.Object obj)
                      throws java.lang.IllegalAccessException
        Returns the value of the field represented by this Field, on the specified object. The value is automatically wrapped in an object if it has a primitive type.

        The underlying field's value is obtained as follows:

        If the underlying field is a static field, the obj argument is ignored; it may be null.

        Otherwise, the underlying field is an instance field. If the specified obj argument is null, the method throws a NullPointerException. If the specified object is not an instance of the class or interface declaring the underlying field, the method throws an IllegalArgumentException.

        If this Field object enforces Java language access control, and the underlying field is inaccessible, the method throws an IllegalAccessException. If the underlying field is static, the class that declared the field is initialized if it has not already been initialized.

        Otherwise, the value is retrieved from the underlying instance or static field. If the field has a primitive type, the value is wrapped in an object before being returned, otherwise it is returned as is.

        If the field is hidden in the type of obj, the field's value is obtained according to the preceding rules.

        Parameters:
        obj - object from which the represented field's value is to be extracted
        Returns:
        the value of the represented field in object obj; primitive values are wrapped in an appropriate object before being returned
        Throws:
        java.lang.IllegalAccessException - if the underlying field is inaccessible.