Class StringCodec
java.lang.Object
io.r2dbc.postgresql.codec.StringCodec
- All Implemented Interfaces:
Codec<String>, CodecMetadata
-
Constructor Summary
ConstructorsConstructorDescriptionStringCodec(io.netty.buffer.ByteBufAllocator byteBufAllocator) StringCodec(io.netty.buffer.ByteBufAllocator byteBufAllocator, PostgresTypeIdentifier defaultType, PostgresTypeIdentifier arrayType) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanDetermine whether thisCodecis capable of encoding thevalue.booleancanEncodeNull(Class<?> type) final Stringdecode(@Nullable io.netty.buffer.ByteBuf buffer, int dataType, io.r2dbc.postgresql.message.Format format, Class<? extends String> type) Decode thebufferand return it as the requestedtype.decode(io.netty.buffer.ByteBuf buffer, PostgresTypeIdentifier dataType, io.r2dbc.postgresql.message.Format format, Class<? extends String> type) Forwarding method todoDecode(ByteBuf, PostgresTypeIdentifier, Format, Class)for subclasses that want to implementArrayCodecDelegate.decode(io.netty.buffer.ByteBuf buffer, PostgresTypeIdentifier dataType, io.r2dbc.postgresql.message.Format format, Class<? extends String> type) Decode thebufferand return it as the requestedtype.final io.r2dbc.postgresql.client.EncodedParameterEncode thevalueto be used as RPC parameter.io.r2dbc.postgresql.client.EncodedParameterEncode thevalueto be used as RPC parameter.io.r2dbc.postgresql.client.EncodedParameterEncode anullvalue.io.r2dbc.postgresql.client.EncodedParameterencodeNull(int dataType) encodeToText(String value) static PostgresTypeIdentifiergetDataType(int dataType) Iterable<? extends PostgresTypeIdentifier> Returns the collection ofPostgresTypeIdentifierthis codec can handleClass<?> type()Returns the Javatypeof this codec.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CodecMetadata
getFormats, type
-
Constructor Details
-
StringCodec
public StringCodec(io.netty.buffer.ByteBufAllocator byteBufAllocator) -
StringCodec
public StringCodec(io.netty.buffer.ByteBufAllocator byteBufAllocator, PostgresTypeIdentifier defaultType, PostgresTypeIdentifier arrayType)
-
-
Method Details
-
encodeNull
public io.r2dbc.postgresql.client.EncodedParameter encodeNull()Description copied from interface:CodecEncode anullvalue.- Specified by:
encodeNullin interfaceCodec<String>- Returns:
- the encoded
nullvalue
-
encodeToText
-
getArrayDataType
-
getDataTypes
Description copied from interface:CodecMetadataReturns the collection ofPostgresTypeIdentifierthis codec can handle- Specified by:
getDataTypesin interfaceCodecMetadata- Returns:
- the datatypes
-
decode
String decode(io.netty.buffer.ByteBuf buffer, PostgresTypeIdentifier dataType, io.r2dbc.postgresql.message.Format format, Class<? extends String> type) Decode thebufferand return it as the requestedtype.- Parameters:
buffer- the data bufferdataType- the Postgres OID to encodeformat- the data typeFormat, text or binarytype- the desired value type- Returns:
- the decoded value. Can be
nullif the value isnull.
-
canDecode
-
canEncode
-
canEncodeNull
Description copied from interface:Codec- Specified by:
canEncodeNullin interfaceCodec<T>- Parameters:
type- the desired value type- Returns:
trueif thisCodecis able to encodenullvalues for the givenClasstype.- See Also:
-
decode
-
encode
-
encode
Description copied from interface:CodecEncode thevalueto be used as RPC parameter. -
getDataType
-
encodeNull
public io.r2dbc.postgresql.client.EncodedParameter encodeNull(int dataType) -
type
Description copied from interface:CodecMetadataReturns the Javatypeof this codec.- Specified by:
typein interfaceCodecMetadata- Returns:
- the Java type
-
decode
public String decode(io.netty.buffer.ByteBuf buffer, PostgresTypeIdentifier dataType, io.r2dbc.postgresql.message.Format format, Class<? extends String> type) Forwarding method todoDecode(ByteBuf, PostgresTypeIdentifier, Format, Class)for subclasses that want to implementArrayCodecDelegate.- Parameters:
buffer- the data bufferdataType- the well-knowntype OIDformat- data type formattype- the desired value type- Returns:
- the decoded value, can be
nullif the column value isnull
-