public abstract class MethodAccessor extends java.lang.Object implements PropertyAccessor
Implements PropertyAccessor interface using method invocation for property access, providing efficient property access for serialization and deserialization operations.
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.reflect.Method |
getter
The getter method for accessing the property value
|
protected java.lang.String |
name
The name of the property being accessed
|
protected java.lang.Class<?> |
propertyClass
The runtime class of the property
|
protected java.lang.reflect.Type |
propertyType
The generic type of the property
|
protected java.lang.reflect.Method |
setter
The setter method for setting the property value
|
| Constructor and Description |
|---|
MethodAccessor(java.lang.String name,
java.lang.reflect.Type propertyType,
java.lang.Class<?> propertyClass,
java.lang.reflect.Method getter,
java.lang.reflect.Method setter)
Constructs a MethodAccessor with the specified parameters.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) JSONException |
errorForGet(java.lang.Throwable e)
Creates a JSON exception for getter errors.
|
(package private) JSONException |
errorForSet(java.lang.Throwable e)
Creates a JSON exception for setter errors.
|
java.lang.String |
name()
Returns the name of the property being accessed.
|
java.lang.Class<?> |
propertyClass()
Returns the runtime class of the property.
|
java.lang.reflect.Type |
propertyType()
Returns the generic type of the property.
|
boolean |
supportGet()
Checks if the property supports getting values.
|
boolean |
supportSet()
Checks if the property supports setting values.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetBooleanValue, getByteValue, getCharValue, getDoubleValue, getFloatValue, getIntValue, getLongValue, getObject, getShortValue, setBooleanValue, setByteValue, setCharValue, setDoubleValue, setFloatValue, setIntValue, setLongValue, setObject, setShortValueprotected final java.lang.String name
protected final java.lang.reflect.Type propertyType
protected final java.lang.Class<?> propertyClass
protected final java.lang.reflect.Method getter
protected final java.lang.reflect.Method setter
public MethodAccessor(java.lang.String name,
java.lang.reflect.Type propertyType,
java.lang.Class<?> propertyClass,
java.lang.reflect.Method getter,
java.lang.reflect.Method setter)
name - the name of the propertypropertyType - the generic type of the propertypropertyClass - the runtime class of the propertygetter - the getter method for accessing the property valuesetter - the setter method for setting the property valuepublic final java.lang.String name()
PropertyAccessorname in interface PropertyAccessorpublic final boolean supportGet()
supportGet in interface PropertyAccessorpublic final boolean supportSet()
supportSet in interface PropertyAccessorpublic final java.lang.Class<?> propertyClass()
PropertyAccessorpropertyClass in interface PropertyAccessorpublic final java.lang.reflect.Type propertyType()
PropertyAccessorpropertyType in interface PropertyAccessorfinal JSONException errorForGet(java.lang.Throwable e)
e - the exception that occurred during gettingfinal JSONException errorForSet(java.lang.Throwable e)
e - the exception that occurred during setting