T - the type that is handled by this codec.public interface Codec<T>
Use ParameterizedCodec for support ParameterizedType encoding/decoding.
| Modifier and Type | Method and Description |
|---|---|
boolean |
canDecode(MySqlReadableMetadata metadata,
Class<?> target)
Checks if the field value can be decoded as specified
Class. |
boolean |
canEncode(Object value)
Checks if it can encode the specified value.
|
T |
decode(io.netty.buffer.ByteBuf value,
MySqlReadableMetadata metadata,
Class<?> target,
boolean binary,
CodecContext context)
Decodes a
ByteBuf as specified Class. |
MySqlParameter |
encode(Object value,
CodecContext context)
Encode a value to a
MySqlParameter. |
default @Nullable Class<? extends T> |
getMainClass()
Gets the main
Class that is handled by this codec. |
@Nullable T decode(io.netty.buffer.ByteBuf value, MySqlReadableMetadata metadata, Class<?> target, boolean binary, CodecContext context)
ByteBuf as specified Class.value - the ByteBuf.metadata - the metadata of the column or the OUT parameter.target - the specified Class.binary - if the value should be decoded by binary protocol.context - the codec context.boolean canDecode(MySqlReadableMetadata metadata, Class<?> target)
Class.metadata - the metadata of the column or the OUT parameter.target - the specified Class.boolean canEncode(Object value)
value - the specified value.MySqlParameter encode(Object value, CodecContext context)
MySqlParameter.value - the specified value.context - the codec context.MySqlParameter.@Nullable default @Nullable Class<? extends T> getMainClass()
Class that is handled by this codec. It is used to fast path the codec lookup if it is not
null. If same main Class is handled by multiple codecs, the codec with the highest priority will
be used. The priority of the fast path is determined by its order in Codecs.Class, or null if it is not in fast path.Copyright © 2018–2024 asyncer.io. All rights reserved.