Interface FieldAdapter


public interface FieldAdapter
Reads and writes one field of objects, created for the field by a FieldAdapterFactory. Every accessor matches the field type: getInt/setInt for an int field, getObject/setObject for a reference field and so on. Final fields are written too: the cloner sets them on fresh copies only.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Reads the value of the boolean field.
    byte
    getByte(Object target)
    Reads the value of the byte field.
    char
    getChar(Object target)
    Reads the value of the char field.
    double
    getDouble(Object target)
    Reads the value of the double field.
    float
    getFloat(Object target)
    Reads the value of the float field.
    int
    getInt(Object target)
    Reads the value of the int field.
    long
    getLong(Object target)
    Reads the value of the long field.
    <T> T
    getObject(Object target)
    Reads the value of the reference field.
    short
    getShort(Object target)
    Reads the value of the short field.
    void
    setBoolean(Object target, boolean value)
    Writes the value of the boolean field.
    void
    setByte(Object target, byte value)
    Writes the value of the byte field.
    void
    setChar(Object target, char value)
    Writes the value of the char field.
    void
    setDouble(Object target, double value)
    Writes the value of the double field.
    void
    setFloat(Object target, float value)
    Writes the value of the float field.
    void
    setInt(Object target, int value)
    Writes the value of the int field.
    void
    setLong(Object target, long value)
    Writes the value of the long field.
    <T> void
    setObject(Object target, T value)
    Writes the value of the reference field.
    void
    setShort(Object target, short value)
    Writes the value of the short field.
  • Method Details

    • getObject

      <T> T getObject(Object target) throws Exception
      Reads the value of the reference field.
      Type Parameters:
      T - value type
      Parameters:
      target - object holding the field
      Returns:
      field value
      Throws:
      Exception - if the field cannot be accessed
    • setObject

      <T> void setObject(Object target, T value) throws Exception
      Writes the value of the reference field.
      Type Parameters:
      T - value type
      Parameters:
      target - object holding the field
      value - new value
      Throws:
      Exception - if the field cannot be accessed
    • getInt

      int getInt(Object target) throws Exception
      Reads the value of the int field.
      Parameters:
      target - object holding the field
      Returns:
      field value
      Throws:
      Exception - if the field cannot be accessed
    • setInt

      void setInt(Object target, int value) throws Exception
      Writes the value of the int field.
      Parameters:
      target - object holding the field
      value - new value
      Throws:
      Exception - if the field cannot be accessed
    • getByte

      byte getByte(Object target) throws Exception
      Reads the value of the byte field.
      Parameters:
      target - object holding the field
      Returns:
      field value
      Throws:
      Exception - if the field cannot be accessed
    • setByte

      void setByte(Object target, byte value) throws Exception
      Writes the value of the byte field.
      Parameters:
      target - object holding the field
      value - new value
      Throws:
      Exception - if the field cannot be accessed
    • getBoolean

      boolean getBoolean(Object target) throws Exception
      Reads the value of the boolean field.
      Parameters:
      target - object holding the field
      Returns:
      field value
      Throws:
      Exception - if the field cannot be accessed
    • setBoolean

      void setBoolean(Object target, boolean value) throws Exception
      Writes the value of the boolean field.
      Parameters:
      target - object holding the field
      value - new value
      Throws:
      Exception - if the field cannot be accessed
    • getShort

      short getShort(Object target) throws Exception
      Reads the value of the short field.
      Parameters:
      target - object holding the field
      Returns:
      field value
      Throws:
      Exception - if the field cannot be accessed
    • setShort

      void setShort(Object target, short value) throws Exception
      Writes the value of the short field.
      Parameters:
      target - object holding the field
      value - new value
      Throws:
      Exception - if the field cannot be accessed
    • getChar

      char getChar(Object target) throws Exception
      Reads the value of the char field.
      Parameters:
      target - object holding the field
      Returns:
      field value
      Throws:
      Exception - if the field cannot be accessed
    • setChar

      void setChar(Object target, char value) throws Exception
      Writes the value of the char field.
      Parameters:
      target - object holding the field
      value - new value
      Throws:
      Exception - if the field cannot be accessed
    • getLong

      long getLong(Object target) throws Exception
      Reads the value of the long field.
      Parameters:
      target - object holding the field
      Returns:
      field value
      Throws:
      Exception - if the field cannot be accessed
    • setLong

      void setLong(Object target, long value) throws Exception
      Writes the value of the long field.
      Parameters:
      target - object holding the field
      value - new value
      Throws:
      Exception - if the field cannot be accessed
    • getFloat

      float getFloat(Object target) throws Exception
      Reads the value of the float field.
      Parameters:
      target - object holding the field
      Returns:
      field value
      Throws:
      Exception - if the field cannot be accessed
    • setFloat

      void setFloat(Object target, float value) throws Exception
      Writes the value of the float field.
      Parameters:
      target - object holding the field
      value - new value
      Throws:
      Exception - if the field cannot be accessed
    • getDouble

      double getDouble(Object target) throws Exception
      Reads the value of the double field.
      Parameters:
      target - object holding the field
      Returns:
      field value
      Throws:
      Exception - if the field cannot be accessed
    • setDouble

      void setDouble(Object target, double value) throws Exception
      Writes the value of the double field.
      Parameters:
      target - object holding the field
      value - new value
      Throws:
      Exception - if the field cannot be accessed