Class OffsetTimeCodec

java.lang.Object
io.r2dbc.postgresql.codec.OffsetTimeCodec
All Implemented Interfaces:
Codec<OffsetTime>, CodecMetadata

public class OffsetTimeCodec extends Object
  • Method Details

    • canDecode

      public boolean canDecode(int dataType, io.r2dbc.postgresql.message.Format format, Class<?> type)
      Description copied from interface: Codec
      Determine whether this Codec is capable of decoding a value for the given dataType and Format and whether it can represent the decoded value as the desired type.
      Specified by:
      canDecode in interface Codec<T extends Temporal>
      Parameters:
      dataType - the Postgres OID to decode
      format - the data type Format, text or binary
      type - the desired value type
      Returns:
      true if this codec is able to decode values for tge given dataType and Format
    • encodeToText

      public final String encodeToText(OffsetTime value)
    • encodeNull

      public final io.r2dbc.postgresql.client.EncodedParameter encodeNull()
      Description copied from interface: Codec
      Encode a null value.
      Specified by:
      encodeNull in interface Codec<T>
      Returns:
      the encoded null value
    • getDataTypes

      public Iterable<PostgresTypeIdentifier> getDataTypes()
      Description copied from interface: CodecMetadata
      Returns the collection of PostgresTypeIdentifier this codec can handle
      Specified by:
      getDataTypes in interface CodecMetadata
      Returns:
      the datatypes
    • getArrayDataType

      public final PostgresTypeIdentifier getArrayDataType()
    • decode

      @Nullable OffsetTime decode(io.netty.buffer.ByteBuf buffer, PostgresTypeIdentifier dataType, io.r2dbc.postgresql.message.Format format, Class<? extends OffsetTime> type)
      Decode the buffer and return it as the requested type.
      Parameters:
      buffer - the data buffer
      dataType - the Postgres OID to encode
      format - the data type Format, text or binary
      type - the desired value type
      Returns:
      the decoded value. Can be null if the value is null.
    • canEncode

      public boolean canEncode(Object value)
      Description copied from interface: Codec
      Determine whether this Codec is capable of encoding the value.
      Specified by:
      canEncode in interface Codec<T>
      Parameters:
      value - the parameter value
      Returns:
      true if this Codec is able to encode the value.
      See Also:
    • canEncodeNull

      public boolean canEncodeNull(Class<?> type)
      Description copied from interface: Codec
      Determine whether this Codec is capable of encoding a null value for the given Class type.
      Specified by:
      canEncodeNull in interface Codec<T>
      Parameters:
      type - the desired value type
      Returns:
      true if this Codec is able to encode null values for the given Class type.
      See Also:
    • decode

      @Nullable public final OffsetTime decode(@Nullable io.netty.buffer.ByteBuf buffer, int dataType, io.r2dbc.postgresql.message.Format format, Class<? extends OffsetTime> type)
      Description copied from interface: Codec
      Decode the buffer and return it as the requested type.
      Specified by:
      decode in interface Codec<T>
      Parameters:
      buffer - the data buffer
      dataType - the Postgres OID to encode
      format - the data type Format, text or binary
      type - the desired value type
      Returns:
      the decoded value. Can be null if the value is null.
    • encode

      public final io.r2dbc.postgresql.client.EncodedParameter encode(Object value)
      Description copied from interface: Codec
      Encode the value to be used as RPC parameter.
      Specified by:
      encode in interface Codec<T>
      Parameters:
      value - the value
      Returns:
      the encoded value
    • encode

      public io.r2dbc.postgresql.client.EncodedParameter encode(Object value, int dataType)
      Description copied from interface: Codec
      Encode the value to be used as RPC parameter.
      Specified by:
      encode in interface Codec<T>
      Parameters:
      value - the value
      dataType - the Postgres OID to encode
      Returns:
      the encoded value
    • getDataType

      public static PostgresTypeIdentifier getDataType(int dataType)
    • encodeNull

      public io.r2dbc.postgresql.client.EncodedParameter encodeNull(int dataType)
    • type

      public Class<?> type()
      Description copied from interface: CodecMetadata
      Returns the Java type of this codec.
      Specified by:
      type in interface CodecMetadata
      Returns:
      the Java type
    • decode

      public OffsetTime decode(io.netty.buffer.ByteBuf buffer, PostgresTypeIdentifier dataType, io.r2dbc.postgresql.message.Format format, Class<? extends OffsetTime> type)
      Forwarding method to AbstractCodec.doDecode(ByteBuf, PostgresTypeIdentifier, Format, Class) for subclasses that want to implement ArrayCodecDelegate.
      Parameters:
      buffer - the data buffer
      dataType - the well-known type OID
      format - data type format
      type - the desired value type
      Returns:
      the decoded value, can be null if the column value is null