Package ghidra.util.database

# Class DBCachedObjectStoreFactory.AbstractDBFieldCodec<VT,OT extends DBAnnotatedObject,FT extends Field>

java.lang.Object
ghidra.util.database.DBCachedObjectStoreFactory.AbstractDBFieldCodec<VT,OT,FT>

All Implemented Interfaces:
  `DBCachedObjectStoreFactory.DBFieldCodec<VT,OT,FT>`

Direct Known Subclasses:
  `AbstractDBTracePropertyMap.SaveableDBFieldCodec`, `DBCachedObjectStoreFactory.BooleanDBFieldCodec`, `DBCachedObjectStoreFactory.ByteArrayDBFieldCodec`, `DBCachedObjectStoreFactory.ByteDBFieldCodec`, `DBCachedObjectStoreFactory.EnumDBByteFieldCodec`, `DBCachedObjectStoreFactory.IntDBFieldCodec`, `DBCachedObjectStoreFactory.LongArrayDBFieldCodec`, `DBCachedObjectStoreFactory.LongDBFieldCodec`, `DBCachedObjectStoreFactory.ShortDBFieldCodec`, `DBCachedObjectStoreFactory.StringDBFieldCodec`, `DBCachedObjectStoreFactory.VariantDBFieldCodec`, `DBTraceObject.ObjectPathDBFieldCodec`, `DBTraceObjectDBFieldCodec`, `DBTraceObjectManager.DBTraceObjectSchemaDBFieldCodec`, `DBTraceOverlaySpaceAdapter.AddressDBFieldCodec`, `DBTraceSymbolManager.VariableStorageDBFieldCodec`, `DBTraceUtils.AbstractOffsetSnapDBFieldCodec`, `DBTraceUtils.CompilerSpecIDDBFieldCodec`, `DBTraceUtils.LanguageIDDBFieldCodec`, `DBTraceUtils.RefTypeDBFieldCodec`, `DBTraceUtils.URLDBFieldCodec`

Enclosing class:
  `DBCachedObjectStoreFactory`

public abstract static class DBCachedObjectStoreFactory.AbstractDBFieldCodec<VT,OT extends DBAnnotatedObject,FT extends Field> extends Object implements DBCachedObjectStoreFactory.DBFieldCodec<VT,OT,FT>
An abstract implementation of `DBCachedObjectStoreFactory.DBFieldCodec`

This reduces the implementation burden to `doLoad(DBAnnotatedObject, DBRecord)`, `doStore(DBAnnotatedObject, DBRecord)`, and `DBCachedObjectStoreFactory.DBFieldCodec.store(Object, db.Field)`.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final int`
  `column`
  `protected final Field`
  `field`
  `protected final Class<FT>`
  `fieldType`
  `protected final Class<OT>`
  `objectType`
  `protected final Class<VT>`
  `valueType`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractDBFieldCodec(Class<VT> valueType, Class<OT> objectType, Class<FT> fieldType, Field field, int column)`
  Construct a codec

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected abstract void`
  `doLoad(OT obj, DBRecord record)`
  Same as `load(DBAnnotatedObject, DBRecord)`, but permits exceptions
  `protected abstract void`
  `doStore(OT obj, DBRecord record)`
  Same as `store(DBAnnotatedObject, DBRecord)`, but permits exceptions
  `Class<FT>`
  `getFieldType()`
  Get the type of field storing the values
  `Class<OT>`
  `getObjectType()`
  Get the upper bound on objects with fields using this codec
  `VT`
  `getValue(OT obj)`
  Get the value from the object
  `Class<VT>`
  `getValueType()`
  Get the type of values encoded and decoded
  `void`
  `load(OT obj, DBRecord record)`
  Decode the field from the given record into the given object
  `protected void`
  `setValue(OT obj, VT value)`
  Set the value of the object
  `void`
  `store(OT obj, DBRecord record)`
  Encode the field from the given object into the given record

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface ghidra.util.database.DBCachedObjectStoreFactory.DBFieldCodec

  `encodeField, store`

- ## Field Details

  - ### valueType

    protected final Class<VT> valueType

  - ### objectType

    protected final Class<OT extends DBAnnotatedObject> objectType

  - ### fieldType

    protected final Class<FT extends Field> fieldType

  - ### field

    protected final Field field

  - ### column

    protected final int column

- ## Constructor Details

  - ### AbstractDBFieldCodec

    public AbstractDBFieldCodec(Class<VT> valueType, Class<OT> objectType, Class<FT> fieldType, Field field, int column)
    Construct a codec
    Parameters:
      `valueType` -
      `objectType` -
      `fieldType` -
      `field` -
      `column` -

- ## Method Details

  - ### store

    public void store(OT obj, DBRecord record)
    Description copied from interface: `DBCachedObjectStoreFactory.DBFieldCodec`
    Encode the field from the given object into the given record
    Specified by:
      `store` in interface `DBCachedObjectStoreFactory.DBFieldCodec<VT,OT extends DBAnnotatedObject,FT extends Field>`
    Parameters:
      `obj` - the source object
      `record` - the destination record

  - ### load

    public void load(OT obj, DBRecord record)
    Description copied from interface: `DBCachedObjectStoreFactory.DBFieldCodec`
    Decode the field from the given record into the given object
    Specified by:
      `load` in interface `DBCachedObjectStoreFactory.DBFieldCodec<VT,OT extends DBAnnotatedObject,FT extends Field>`
    Parameters:
      `obj` - the destination object
      `record` - the source record

  - ### getValueType

    public Class<VT> getValueType()
    Description copied from interface: `DBCachedObjectStoreFactory.DBFieldCodec`
    Get the type of values encoded and decoded
    Specified by:
      `getValueType` in interface `DBCachedObjectStoreFactory.DBFieldCodec<VT,OT extends DBAnnotatedObject,FT extends Field>`
    Returns:
      the value type

  - ### getObjectType

    public Class<OT> getObjectType()
    Description copied from interface: `DBCachedObjectStoreFactory.DBFieldCodec`
    Get the upper bound on objects with fields using this codec
    Specified by:
      `getObjectType` in interface `DBCachedObjectStoreFactory.DBFieldCodec<VT,OT extends DBAnnotatedObject,FT extends Field>`
    Returns:
      the upper bound

  - ### getFieldType

    public Class<FT> getFieldType()
    Description copied from interface: `DBCachedObjectStoreFactory.DBFieldCodec`
    Get the type of field storing the values
    Specified by:
      `getFieldType` in interface `DBCachedObjectStoreFactory.DBFieldCodec<VT,OT extends DBAnnotatedObject,FT extends Field>`
    Returns:
      the field type

  - ### getValue

    public VT getValue(OT obj)
    Description copied from interface: `DBCachedObjectStoreFactory.DBFieldCodec`
    Get the value from the object
    Specified by:
      `getValue` in interface `DBCachedObjectStoreFactory.DBFieldCodec<VT,OT extends DBAnnotatedObject,FT extends Field>`
    Parameters:
      `obj` - the source object
    Returns:
      the value

  - ### setValue

    protected void setValue(OT obj, VT value) throws IllegalArgumentException, IllegalAccessException
    Set the value of the object
    Parameters:
      `obj` - the object whose field to set
      `value` - the value to assign
    Throws:
      `IllegalArgumentException` - as in `Field.set(Object, Object)`
      `IllegalAccessException` - as in `Field.set(Object, Object)`

  - ### doStore

    protected abstract void doStore(OT obj, DBRecord record) throws IllegalArgumentException, IllegalAccessException
    Same as `store(DBAnnotatedObject, DBRecord)`, but permits exceptions
    Throws:
      `IllegalArgumentException`
      `IllegalAccessException`

  - ### doLoad

    protected abstract void doLoad(OT obj, DBRecord record) throws IllegalArgumentException, IllegalAccessException
    Same as `load(DBAnnotatedObject, DBRecord)`, but permits exceptions
    Throws:
      `IllegalArgumentException`
      `IllegalAccessException`