org.apache.tinkerpop.gremlin.driver.ser.binary.types

## Class SimpleTypeSerializer<T>

- java.lang.Object
- - org.apache.tinkerpop.gremlin.driver.ser.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(ByteBuf buffer, GraphBinaryReader context)` Reads the type information and value from the buffer and returns an instance of T.
    `protected abstract T` | `readValue(ByteBuf buffer, GraphBinaryReader context)` Reads a non-nullable value according to the type format.
    `T` | `readValue(ByteBuf 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, ByteBuf buffer, GraphBinaryWriter context)` Writes the type code, information and value to a buffer using the provided allocator.
    `protected abstract void` | `writeValue(T value, ByteBuf buffer, GraphBinaryWriter context)` Writes a non-nullable value into a buffer using the provided allocator.
    `void` | `writeValue(T value, ByteBuf 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(ByteBuf buffer,
                        GraphBinaryReader context)
                 throws SerializationException

      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:
        `SerializationException`

    - #### readValue

          public T readValue(ByteBuf buffer,
                             GraphBinaryReader context,
                             boolean nullable)
                      throws SerializationException

      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:
        `SerializationException`

    - #### readValue

          protected abstract T readValue(ByteBuf buffer,
                                         GraphBinaryReader context)
                                  throws SerializationException

      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 writer.
      Returns:
      Throws:
        `SerializationException`

    - #### write

          public void write(T value,
                            ByteBuf buffer,
                            GraphBinaryWriter context)
                     throws SerializationException

      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:
        `SerializationException`

    - #### writeValue

          public void writeValue(T value,
                                 ByteBuf buffer,
                                 GraphBinaryWriter context,
                                 boolean nullable)
                          throws SerializationException

      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:
        `SerializationException`

    - #### writeValue

          protected abstract void writeValue(T value,
                                             ByteBuf buffer,
                                             GraphBinaryWriter context)
                                      throws SerializationException

      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:
        `SerializationException`

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