org.apache.tinkerpop.gremlin.structure.io.binary.types

## Class SimpleTypeSerializer<T>

- java.lang.Object
- - org.apache.tinkerpop.gremlin.structure.io.binary.types.SimpleTypeSerializer<T>

- All Implemented Interfaces:
    TypeSerializer<T>
  Direct Known Subclasses:
    BigDecimalSerializer, BigIntegerSerializer, BindingSerializer, BulkSetSerializer, ByteBufferSerializer, ByteCodeSerializer, CharSerializer, ClassSerializer, DateSerializer, DurationSerializer, EdgeSerializer, EnumSerializer, GraphSerializer, InetAddressSerializer, InstantSerializer, LambdaSerializer, ListSerializer, LocalDateSerializer, LocalDateTimeSerializer, LocalTimeSerializer, MapEntrySerializer, MapSerializer, MetricsSerializer, MonthDaySerializer, OffsetDateTimeSerializer, OffsetTimeSerializer, PathSerializer, PeriodSerializer, PropertySerializer, PSerializer, SetSerializer, SingleTypeSerializer, StringSerializer, TraversalExplanationSerializer, TraversalMetricsSerializer, TraversalStrategySerializer, TraverserSerializer, TreeSerializer, UUIDSerializer, VertexPropertySerializer, VertexSerializer, YearMonthSerializer, ZonedDateTimeSerializer, ZoneOffsetSerializer

      public abstract class SimpleTypeSerializer<T>
      extends Object
      implements TypeSerializer<T>

  Base class for serialization of types that don't contain type specific information only {type_code}, {value_flag} and {value}.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpleTypeSerializer(DataType dataType)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `DataType` | `getDataType()` Gets the `DataType` that is represented by the given `T`.
    `T` | `read(Buffer buffer, GraphBinaryReader context)` Reads the type information and value from the buffer and returns an instance of T.
    `protected abstract T` | `readValue(Buffer buffer, GraphBinaryReader context)` Reads a non-nullable value according to the type format.
    `T` | `readValue(Buffer buffer, GraphBinaryReader context, boolean nullable)` Reads the value from the buffer (not the type information) and returns an instance of T.
    `void` | `write(T value, Buffer buffer, GraphBinaryWriter context)` Writes the type code, information and value to a buffer using the provided allocator.
    `protected abstract void` | `writeValue(T value, Buffer buffer, GraphBinaryWriter context)` Writes a non-nullable value into a buffer using the provided allocator.
    `void` | `writeValue(T value, Buffer buffer, GraphBinaryWriter context, boolean nullable)` Writes the value to a buffer, composed by the value flag and the sequence of bytes.

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

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

- - ### Constructor Detail

    - #### SimpleTypeSerializer

          public SimpleTypeSerializer(DataType dataType)

  - ### Method Detail

    - #### getDataType

          public DataType getDataType()

      Description copied from interface: `TypeSerializer`
      Gets the `DataType` that is represented by the given `T`.
      Specified by:
        `getDataType` in interface `TypeSerializer<T>`

    - #### read

          public T read(Buffer buffer,
                        GraphBinaryReader context)
                 throws IOException

      Description copied from interface: `TypeSerializer`
      Reads the type information and value from the buffer and returns an instance of T.
      Specified by:
        `read` in interface `TypeSerializer<T>`
      Throws:
        `IOException`

    - #### readValue

          public T readValue(Buffer buffer,
                             GraphBinaryReader context,
                             boolean nullable)
                      throws IOException

      Description copied from interface: `TypeSerializer`
      Reads the value from the buffer (not the type information) and returns an instance of T.

      Implementors should throw an exception when a complex type doesn't support reading without the type information.

      Specified by:
        `readValue` in interface `TypeSerializer<T>`
      Throws:
        `IOException`

    - #### readValue

          protected abstract T readValue(Buffer buffer,
                                         GraphBinaryReader context)
                                  throws IOException

      Reads a non-nullable value according to the type format.
      Parameters:
        `buffer` - A buffer which reader index has been set to the beginning of the {value}.
        `context` - The binary reader.
      Returns:
      Throws:
        `IOException`

    - #### write

          public void write(T value,
                            Buffer buffer,
                            GraphBinaryWriter context)
                     throws IOException

      Description copied from interface: `TypeSerializer`
      Writes the type code, information and value to a buffer using the provided allocator.
      Specified by:
        `write` in interface `TypeSerializer<T>`
      Throws:
        `IOException`

    - #### writeValue

          public void writeValue(T value,
                                 Buffer buffer,
                                 GraphBinaryWriter context,
                                 boolean nullable)
                          throws IOException

      Description copied from interface: `TypeSerializer`
      Writes the value to a buffer, composed by the value flag and the sequence of bytes.
      Specified by:
        `writeValue` in interface `TypeSerializer<T>`
      Throws:
        `IOException`

    - #### writeValue

          protected abstract void writeValue(T value,
                                             Buffer buffer,
                                             GraphBinaryWriter context)
                                      throws IOException

      Writes a non-nullable value into a buffer using the provided allocator.
      Parameters:
        `value` - A non-nullable value.
        `buffer` - The buffer allocator to use.
        `context` - The binary writer.
      Throws:
        `IOException`

Copyright © 2013–2021 Apache Software Foundation. All rights reserved.