Package ghidra.util.database

# Interface DBCachedObjectStoreFactory.PrimitiveCodec<T>

Type Parameters:
  `T` - the type of values encoded

All Known Implementing Classes:
  `DBCachedObjectStoreFactory.PrimitiveCodec.AbstractPrimitiveCodec`, `DBCachedObjectStoreFactory.PrimitiveCodec.ArrayObjectCodec`, `DBCachedObjectStoreFactory.PrimitiveCodec.ArrayPrimitiveCodec`, `DBCachedObjectStoreFactory.PrimitiveCodec.LengthBoundCodec`, `DBCachedObjectStoreFactory.PrimitiveCodec.SimplePrimitiveCodec`

Enclosing class:
  `DBCachedObjectStoreFactory`

public static interface DBCachedObjectStoreFactory.PrimitiveCodec<T>
Codec for a primitive type

This is used by `DBCachedObjectStoreFactory.VariantDBFieldCodec` to encode primitive values. Sadly, the existing primitive field codecs cannot be used, since they write to fields directly. All these encode into byte buffers, since the variant codec uses `BinaryField`.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static class`
  `DBCachedObjectStoreFactory.PrimitiveCodec.AbstractPrimitiveCodec<T>`
  An abstract implementation of `DBCachedObjectStoreFactory.PrimitiveCodec`
  `static class`
  `DBCachedObjectStoreFactory.PrimitiveCodec.ArrayObjectCodec<E>`
  An implementation of an array codec, using its element codec, where elements are objects
  `static class`
  `DBCachedObjectStoreFactory.PrimitiveCodec.ArrayPrimitiveCodec<E,T>`
  An implementation of an array codec, using its element codec, where elements can be primitives
  `static class`
  `DBCachedObjectStoreFactory.PrimitiveCodec.LengthBoundCodec<T>`
  A codec which encodes length-value, using the (unbounded) codec for value
  `static class`
  `DBCachedObjectStoreFactory.PrimitiveCodec.SimplePrimitiveCodec<T>`
  A implementation of `DBCachedObjectStoreFactory.PrimitiveCodec` from lambdas or method references

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final DBCachedObjectStoreFactory.PrimitiveCodec<DBCachedObjectStoreFactory.RecAddress>`
  `ADDRESS`
  `static final DBCachedObjectStoreFactory.PrimitiveCodec<Boolean>`
  `BOOL`
  Codec for `boolean`
  `static final DBCachedObjectStoreFactory.PrimitiveCodec<boolean[]>`
  `BOOL_ARR`
  Codec for `boolean[]`
  `static final DBCachedObjectStoreFactory.PrimitiveCodec<Byte>`
  `BYTE`
  Codec for `byte`
  `static final DBCachedObjectStoreFactory.PrimitiveCodec<byte[]>`
  `BYTE_ARR`
  Codec for `byte[]`
  `static final DBCachedObjectStoreFactory.PrimitiveCodec<Character>`
  `CHAR`
  Codec for `char`
  `static final DBCachedObjectStoreFactory.PrimitiveCodec<char[]>`
  `CHAR_ARR`
  Codec for `char[]`
  `static final Map<Class<?>,DBCachedObjectStoreFactory.PrimitiveCodec<?>>`
  `CODECS_BY_CLASS`
  `static final Map<Byte,DBCachedObjectStoreFactory.PrimitiveCodec<?>>`
  `CODECS_BY_SELECTOR`
  `static final DBCachedObjectStoreFactory.PrimitiveCodec<Integer>`
  `INT`
  Codec for `int`
  `static final DBCachedObjectStoreFactory.PrimitiveCodec<int[]>`
  `INT_ARR`
  Codec for `int[]`
  `static final DBCachedObjectStoreFactory.PrimitiveCodec<Long>`
  `LONG`
  Codec for `long`
  `static final DBCachedObjectStoreFactory.PrimitiveCodec<long[]>`
  `LONG_ARR`
  Codec for `long[]`
  `static final DBCachedObjectStoreFactory.PrimitiveCodec<DBCachedObjectStoreFactory.RecRange>`
  `RANGE`
  `static final DBCachedObjectStoreFactory.PrimitiveCodec<Short>`
  `SHORT`
  Codec for `short`
  `static final DBCachedObjectStoreFactory.PrimitiveCodec<short[]>`
  `SHORT_ARR`
  Codec for `short[]`
  `static final DBCachedObjectStoreFactory.PrimitiveCodec<String>`
  `STRING`
  Codec for `String`
  `static final DBCachedObjectStoreFactory.PrimitiveCodec<String[]>`
  `STRING_ARR`
  Codec for `String[]`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `T`
  `decode(ByteBuffer buffer)`
  Decode the value from the given buffer
  `void`
  `encode(ByteBuffer buffer, T value)`
  Encode the value into the given buffer
  `static DBCachedObjectStoreFactory.PrimitiveCodec<?>`
  `getCodec(byte sel)`
  Get the codec for the given selector
  `static <T> DBCachedObjectStoreFactory.PrimitiveCodec<T>`
  `getCodec(Class<T> cls)`
  Get the codec for the given type
  `byte`
  `getSelector()`
  A byte value which identifies this codec's type as the selected type
  `Class<T>`
  `getValueClass()`
  The class describing `DBCachedObjectStoreFactory.PrimitiveCodec`

- ## Field Details

  - ### BOOL

    static final DBCachedObjectStoreFactory.PrimitiveCodec<Boolean> BOOL
    Codec for `boolean`

  - ### BYTE

    static final DBCachedObjectStoreFactory.PrimitiveCodec<Byte> BYTE
    Codec for `byte`

  - ### CHAR

    static final DBCachedObjectStoreFactory.PrimitiveCodec<Character> CHAR
    Codec for `char`

  - ### SHORT

    static final DBCachedObjectStoreFactory.PrimitiveCodec<Short> SHORT
    Codec for `short`

  - ### INT

    static final DBCachedObjectStoreFactory.PrimitiveCodec<Integer> INT
    Codec for `int`

  - ### LONG

    static final DBCachedObjectStoreFactory.PrimitiveCodec<Long> LONG
    Codec for `long`

  - ### STRING

    static final DBCachedObjectStoreFactory.PrimitiveCodec<String> STRING
    Codec for `String`

  - ### BOOL_ARR

    static final DBCachedObjectStoreFactory.PrimitiveCodec<boolean[]> BOOL_ARR
    Codec for `boolean[]`

  - ### BYTE_ARR

    static final DBCachedObjectStoreFactory.PrimitiveCodec<byte[]> BYTE_ARR
    Codec for `byte[]`

  - ### CHAR_ARR

    static final DBCachedObjectStoreFactory.PrimitiveCodec<char[]> CHAR_ARR
    Codec for `char[]`

  - ### SHORT_ARR

    static final DBCachedObjectStoreFactory.PrimitiveCodec<short[]> SHORT_ARR
    Codec for `short[]`

  - ### INT_ARR

    static final DBCachedObjectStoreFactory.PrimitiveCodec<int[]> INT_ARR
    Codec for `int[]`

  - ### LONG_ARR

    static final DBCachedObjectStoreFactory.PrimitiveCodec<long[]> LONG_ARR
    Codec for `long[]`

  - ### STRING_ARR

    static final DBCachedObjectStoreFactory.PrimitiveCodec<String[]> STRING_ARR
    Codec for `String[]`

  - ### ADDRESS

    static final DBCachedObjectStoreFactory.PrimitiveCodec<DBCachedObjectStoreFactory.RecAddress> ADDRESS

  - ### RANGE

    static final DBCachedObjectStoreFactory.PrimitiveCodec<DBCachedObjectStoreFactory.RecRange> RANGE

  - ### CODECS_BY_SELECTOR

    static final Map<Byte,DBCachedObjectStoreFactory.PrimitiveCodec<?>> CODECS_BY_SELECTOR

  - ### CODECS_BY_CLASS

    static final Map<Class<?>,DBCachedObjectStoreFactory.PrimitiveCodec<?>> CODECS_BY_CLASS

- ## Method Details

  - ### getSelector

    byte getSelector()
    A byte value which identifies this codec's type as the selected type
    Returns:
      the selector

  - ### decode

    T decode(ByteBuffer buffer)
    Decode the value from the given buffer
    Parameters:
      `buffer` - the source buffer
    Returns:
      the value

  - ### encode

    void encode(ByteBuffer buffer, T value)
    Encode the value into the given buffer
    Parameters:
      `buffer` - the destination buffer
      `value` - the value

  - ### getValueClass

    Class<T> getValueClass()
    The class describing `DBCachedObjectStoreFactory.PrimitiveCodec`
    Returns:
      the class

  - ### getCodec

    static <T> DBCachedObjectStoreFactory.PrimitiveCodec<T> getCodec(Class<T> cls)
    Get the codec for the given type
    Type Parameters:
      `T` - the type
    Parameters:
      `cls` - the class describing `DBCachedObjectStoreFactory.PrimitiveCodec`
    Returns:
      the codec
    Throws:
      `IllegalArgumentException` - if the type is not supported

  - ### getCodec

    static DBCachedObjectStoreFactory.PrimitiveCodec<?> getCodec(byte sel)
    Get the codec for the given selector
    Parameters:
      `sel` - the selector
    Returns:
      the codec
    Throws:
      `IllegalArgumentException` - if the selector is unknown