Package org.supercsv.util
Class MethodCache
java.lang.Object
org.supercsv.util.MethodCache
This class cache's method lookups. Hence first time it introspects the instance's class, while subsequent method
lookups are super fast.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TwoDHashMap
<String, String, Method> A cache of getter methods.private final ThreeDHashMap
<Class<?>, Class<?>, String, Method> A cache of setter methods. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetGetMethod
(Object object, String fieldName) Returns the getter method for field on an object.<T> Method
getSetMethod
(Object object, String fieldName, Class<?> argumentType) Returns the setter method for the field on an object.
-
Field Details
-
setMethodsCache
A cache of setter methods. The three keys are the class the setter is being invoked on, the parameter type of the setter, and the variable name. The value is the setter method. -
getCache
A cache of getter methods. The two keys are the name of the class the getter is being invoked on, and the variable name. The value is the getter method.
-
-
Constructor Details
-
MethodCache
public MethodCache()
-
-
Method Details
-
getGetMethod
Returns the getter method for field on an object.- Parameters:
object
- the objectfieldName
- the field name- Returns:
- the getter associated with the field on the object
- Throws:
NullPointerException
- if object or fieldName is nullSuperCsvReflectionException
- if the getter doesn't exist or is not visible
-
getSetMethod
Returns the setter method for the field on an object.- Type Parameters:
T
- the object type- Parameters:
object
- the objectfieldName
- the field nameargumentType
- the type to be passed to the setter- Returns:
- the setter method associated with the field on the object
- Throws:
NullPointerException
- if object, fieldName or fieldType is nullSuperCsvReflectionException
- if the setter doesn't exist or is not visible
-