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

## Interface TypeSerializer<T>

- All Known Subinterfaces:
    CustomTypeSerializer<T>, TransformSerializer<T>
  All Known Implementing Classes:
    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, SimpleTypeSerializer, SingleTypeSerializer, StringSerializer, TraversalExplanationSerializer, TraversalMetricsSerializer, TraversalStrategySerializer, TraverserSerializer, TreeSerializer, UUIDSerializer, VertexPropertySerializer, VertexSerializer, YearMonthSerializer, ZonedDateTimeSerializer, ZoneOffsetSerializer

      public interface TypeSerializer<T>

  Represents a serializer for a given type.

- - ### Method Summary

    All Methods Instance Methods Abstract 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.
    `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.
    `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.

- - ### Method Detail

    - #### getDataType

          DataType getDataType()

      Gets the `DataType` that is represented by the given `T`.

    - #### read

          T read(ByteBuf buffer,
                 GraphBinaryReader context)
          throws SerializationException

      Reads the type information and value from the buffer and returns an instance of T.
      Throws:
        `SerializationException`

    - #### readValue

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

      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.

      Throws:
        `SerializationException`

    - #### write

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

      Writes the type code, information and value to a buffer using the provided allocator.
      Throws:
        `SerializationException`

    - #### writeValue

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

      Writes the value to a buffer, composed by the value flag and the sequence of bytes.
      Throws:
        `SerializationException`

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