Documentation of 'org.supercsv.util.ReflectionUtils' Java class
ReflectionUtils
org.supercsv.util

Class ReflectionUtils



  • public final class ReflectionUtils
    extends java.lang.Object
    Provides useful utility methods for reflection.
    Since:
    2.0.0
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String GET_PREFIX 
      static java.lang.String IS_PREFIX 
      static java.lang.String SET_PREFIX 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.lang.reflect.Method findGetter(java.lang.Object object, java.lang.String fieldName)
      Returns the getter method associated with the object's field.
      static java.lang.reflect.Method findSetter(java.lang.Object object, java.lang.String fieldName, java.lang.Class<?> argumentType)
      Returns the setter method associated with the object's field.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • findGetter

        public static java.lang.reflect.Method findGetter(java.lang.Object object,
                                                          java.lang.String fieldName)
        Returns the getter method associated with the object's field.
        Parameters:
        object - the object
        fieldName - the name of the field
        Returns:
        the getter method
        Throws:
        java.lang.NullPointerException - if object or fieldName is null
        SuperCsvReflectionException - if the getter doesn't exist or is not visible
      • findSetter

        public static java.lang.reflect.Method findSetter(java.lang.Object object,
                                                          java.lang.String fieldName,
                                                          java.lang.Class<?> argumentType)
        Returns the setter method associated with the object's field.

        This method handles any autoboxing/unboxing of the argument passed to the setter (e.g. if the setter type is a primitive int but the argument passed to the setter is an Integer) by looking for a setter with the same type, and failing that checking for a setter with the corresponding primitive/wrapper type.

        It also allows for an argument type that is a subclass or implementation of the setter type (when the setter type is an Object or interface respectively).

        Parameters:
        object - the object
        fieldName - the name of the field
        argumentType - the type to be passed to the setter
        Returns:
        the setter method
        Throws:
        java.lang.NullPointerException - if object, fieldName or fieldType is null
        SuperCsvReflectionException - if the setter doesn't exist or is not visible

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.