Class EnumCodec<T extends Enum<T>>
java.lang.Object
io.r2dbc.postgresql.codec.EnumCodec<T>
- Type Parameters:
T- enum type
- All Implemented Interfaces:
Codec<T>, CodecMetadata
Codec to map Postgres
enumerated types to Java Enum values.
This codec uses Enum.name() to map Postgres enum values as these are represented as string values.
Note that enum values are case-sensitive.
- Since:
- 0.8.4
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder forCodecRegistrarto registerEnumCodecfor one or more enum type mappings. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic EnumCodec.Builderbuilder()Create a newEnumCodec.Builderto build aCodecRegistrarto dynamically register Postgresenumtypes toEnumvalues.booleanbooleanDetermine whether thisCodecis capable of encoding thevalue.booleancanEncodeNull(Class<?> type) decode(io.netty.buffer.ByteBuf buffer, int dataType, io.r2dbc.postgresql.message.Format format, Class<? extends T> type) Decode thebufferand return it as the requestedtype.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.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
-
Constructor Details
-
EnumCodec
-
-
Method Details
-
canDecode
-
canEncode
-
canEncodeNull
Description copied from interface:Codec -
decode
-
encode
-
encode
Description copied from interface:CodecEncode thevalueto be used as RPC parameter. -
encodeNull
-
type
Description copied from interface:CodecMetadataReturns the Javatypeof this codec.- Specified by:
typein interfaceCodecMetadata- Returns:
- the Java type
-
getDataTypes
Description copied from interface:CodecMetadataReturns the collection ofPostgresTypeIdentifierthis codec can handle- Specified by:
getDataTypesin interfaceCodecMetadata- Returns:
- the datatypes
-
builder
Create a newEnumCodec.Builderto build aCodecRegistrarto dynamically register Postgresenumtypes toEnumvalues.- Returns:
- a new builder.
-