Interface PropertyAccessor
- All Known Subinterfaces:
PropertyAccessorFactory.PropertyAccessorBigDecimal, PropertyAccessorFactory.PropertyAccessorBigInteger, PropertyAccessorFactory.PropertyAccessorBoolean, PropertyAccessorFactory.PropertyAccessorBooleanValue, PropertyAccessorFactory.PropertyAccessorByte, PropertyAccessorFactory.PropertyAccessorByteValue, PropertyAccessorFactory.PropertyAccessorCharacter, PropertyAccessorFactory.PropertyAccessorCharValue, PropertyAccessorFactory.PropertyAccessorDouble, PropertyAccessorFactory.PropertyAccessorDoubleValue, PropertyAccessorFactory.PropertyAccessorFloat, PropertyAccessorFactory.PropertyAccessorInteger, PropertyAccessorFactory.PropertyAccessorIntValue, PropertyAccessorFactory.PropertyAccessorLong, PropertyAccessorFactory.PropertyAccessorLongValue, PropertyAccessorFactory.PropertyAccessorNumber, PropertyAccessorFactory.PropertyAccessorObject, PropertyAccessorFactory.PropertyAccessorShort, PropertyAccessorFactory.PropertyAccessorShortValue, PropertyAccessorFactory.PropertyAccessorString
- All Known Implementing Classes:
FieldAccessor, FunctionAccessor, MethodAccessor
public interface PropertyAccessor
Interface for accessing object properties generically.
Provides unified methods for getting and setting properties of objects,
supporting both primitive types and objects through various accessor methods.
Used internally by fastjson2 for efficient property access during serialization
and deserialization operations.
-
Method Summary
Modifier and TypeMethodDescriptionbooleangetBooleanValue(Object object) Gets the property value as a boolean.bytegetByteValue(Object object) Gets the property value as a byte.chargetCharValue(Object object) Gets the property value as a char.doublegetDoubleValue(Object object) Gets the property value as a double.floatgetFloatValue(Object object) Gets the property value as a float.intgetIntValue(Object object) Gets the property value as an int.longgetLongValue(Object object) Gets the property value as a long.Gets the property value as an Object.shortgetShortValue(Object object) Gets the property value as a short.name()Returns the name of the property being accessed.Class<?> Returns the runtime class of the property.Returns the generic type of the property.voidsetBooleanValue(Object object, boolean value) Sets the property value from a boolean.voidsetByteValue(Object object, byte value) Sets the property value from a byte.voidsetCharValue(Object object, char value) Sets the property value from a char.voidsetDoubleValue(Object object, double value) Sets the property value from a double.voidsetFloatValue(Object object, float value) Sets the property value from a float.voidsetIntValue(Object object, int value) Sets the property value from an int.voidsetLongValue(Object object, long value) Sets the property value from a long.voidSets the property value from an Object.voidsetShortValue(Object object, short value) Sets the property value from a short.booleanChecks if the property supports getting values.booleanChecks if the property supports setting values.
-
Method Details
-
name
-
propertyClass
-
propertyType
-
supportGet
boolean supportGet()Checks if the property supports getting values.- Returns:
- true if the property can be read, false otherwise
-
supportSet
boolean supportSet()Checks if the property supports setting values.- Returns:
- true if the property can be written, false otherwise
-
getObject
-
getByteValue
Gets the property value as a byte.- Parameters:
object- the object to get the property from- Returns:
- the property value as byte
-
getCharValue
Gets the property value as a char.- Parameters:
object- the object to get the property from- Returns:
- the property value as char
-
getShortValue
Gets the property value as a short.- Parameters:
object- the object to get the property from- Returns:
- the property value as short
-
getIntValue
Gets the property value as an int.- Parameters:
object- the object to get the property from- Returns:
- the property value as int
-
getLongValue
Gets the property value as a long.- Parameters:
object- the object to get the property from- Returns:
- the property value as long
-
getFloatValue
Gets the property value as a float.- Parameters:
object- the object to get the property from- Returns:
- the property value as float
-
getDoubleValue
Gets the property value as a double.- Parameters:
object- the object to get the property from- Returns:
- the property value as double
-
getBooleanValue
Gets the property value as a boolean.- Parameters:
object- the object to get the property from- Returns:
- the property value as boolean
-
setObject
-
setByteValue
Sets the property value from a byte.- Parameters:
object- the object to set the property onvalue- the byte value to set
-
setCharValue
Sets the property value from a char.- Parameters:
object- the object to set the property onvalue- the char value to set
-
setShortValue
Sets the property value from a short.- Parameters:
object- the object to set the property onvalue- the short value to set
-
setIntValue
Sets the property value from an int.- Parameters:
object- the object to set the property onvalue- the int value to set
-
setLongValue
Sets the property value from a long.- Parameters:
object- the object to set the property onvalue- the long value to set
-
setFloatValue
Sets the property value from a float.- Parameters:
object- the object to set the property onvalue- the float value to set
-
setDoubleValue
Sets the property value from a double.- Parameters:
object- the object to set the property onvalue- the double value to set
-
setBooleanValue
Sets the property value from a boolean.- Parameters:
object- the object to set the property onvalue- the boolean value to set
-