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 Details

    • name

      String name()
      Returns the name of the property being accessed.
      Returns:
      the property name
    • propertyClass

      Class<?> propertyClass()
      Returns the runtime class of the property.
      Returns:
      the property class
    • propertyType

      Type propertyType()
      Returns the generic type of the property.
      Returns:
      the property type
    • 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

      Object getObject(Object object)
      Gets the property value as an Object.
      Parameters:
      object - the object to get the property from
      Returns:
      the property value as Object
    • getByteValue

      byte getByteValue(Object object)
      Gets the property value as a byte.
      Parameters:
      object - the object to get the property from
      Returns:
      the property value as byte
    • getCharValue

      char getCharValue(Object object)
      Gets the property value as a char.
      Parameters:
      object - the object to get the property from
      Returns:
      the property value as char
    • getShortValue

      short getShortValue(Object object)
      Gets the property value as a short.
      Parameters:
      object - the object to get the property from
      Returns:
      the property value as short
    • getIntValue

      int getIntValue(Object object)
      Gets the property value as an int.
      Parameters:
      object - the object to get the property from
      Returns:
      the property value as int
    • getLongValue

      long getLongValue(Object object)
      Gets the property value as a long.
      Parameters:
      object - the object to get the property from
      Returns:
      the property value as long
    • getFloatValue

      float getFloatValue(Object object)
      Gets the property value as a float.
      Parameters:
      object - the object to get the property from
      Returns:
      the property value as float
    • getDoubleValue

      double getDoubleValue(Object object)
      Gets the property value as a double.
      Parameters:
      object - the object to get the property from
      Returns:
      the property value as double
    • getBooleanValue

      boolean getBooleanValue(Object object)
      Gets the property value as a boolean.
      Parameters:
      object - the object to get the property from
      Returns:
      the property value as boolean
    • setObject

      void setObject(Object object, Object value)
      Sets the property value from an Object.
      Parameters:
      object - the object to set the property on
      value - the value to set
    • setByteValue

      void setByteValue(Object object, byte value)
      Sets the property value from a byte.
      Parameters:
      object - the object to set the property on
      value - the byte value to set
    • setCharValue

      void setCharValue(Object object, char value)
      Sets the property value from a char.
      Parameters:
      object - the object to set the property on
      value - the char value to set
    • setShortValue

      void setShortValue(Object object, short value)
      Sets the property value from a short.
      Parameters:
      object - the object to set the property on
      value - the short value to set
    • setIntValue

      void setIntValue(Object object, int value)
      Sets the property value from an int.
      Parameters:
      object - the object to set the property on
      value - the int value to set
    • setLongValue

      void setLongValue(Object object, long value)
      Sets the property value from a long.
      Parameters:
      object - the object to set the property on
      value - the long value to set
    • setFloatValue

      void setFloatValue(Object object, float value)
      Sets the property value from a float.
      Parameters:
      object - the object to set the property on
      value - the float value to set
    • setDoubleValue

      void setDoubleValue(Object object, double value)
      Sets the property value from a double.
      Parameters:
      object - the object to set the property on
      value - the double value to set
    • setBooleanValue

      void setBooleanValue(Object object, boolean value)
      Sets the property value from a boolean.
      Parameters:
      object - the object to set the property on
      value - the boolean value to set