Package io.micronaut.nats.serdes
Class JavaLangNatsMessageSerDes
java.lang.Object
io.micronaut.nats.serdes.JavaLangNatsMessageSerDes
- All Implemented Interfaces:
- io.micronaut.core.order.Ordered,- NatsMessageSerDes<Object>
@Singleton
public class JavaLangNatsMessageSerDes
extends Object
implements NatsMessageSerDes<Object>
Serializes and deserializes standard Java types.
- Since:
- 1.0.0
- Author:
- jgrimm
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final List<NatsMessageSerDes>static final IntegerThe order of this serDes.Fields inherited from interface io.micronaut.core.order.OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptiondeserialize(io.nats.client.Message message, io.micronaut.core.type.Argument<Object> argument) Deserializes the message into the requested type.protected @Nullable NatsMessageSerDesfindSerDes(io.micronaut.core.type.Argument<?> type) Finds the correct serDes based on the type.protected @NonNull NatsMessageSerDes<Boolean>protected @NonNull NatsMessageSerDes<byte[]>protected @NonNull NatsMessageSerDes<ByteBuffer>protected @NonNull NatsMessageSerDes<Double>protected @NonNull NatsMessageSerDes<Float>protected @NonNull NatsMessageSerDes<Integer>protected @NonNull NatsMessageSerDes<Long>intgetOrder()protected @NonNull NatsMessageSerDes<Short>protected @NonNull NatsMessageSerDes<String>protected @NonNull NatsMessageSerDes<UUID>byte[]Serializes the data into a byte[] to be published to nats.booleanDetermines if this serdes supports the given type.
- 
Field Details- 
ORDERThe order of this serDes.
- 
javaSerDes
 
- 
- 
Constructor Details- 
JavaLangNatsMessageSerDespublic JavaLangNatsMessageSerDes()Default constructor.
 
- 
- 
Method Details- 
serializeDescription copied from interface:NatsMessageSerDesSerializes the data into a byte[] to be published to nats.- Specified by:
- serializein interface- NatsMessageSerDes<Object>
- Parameters:
- data- The data to serialize
- Returns:
- The message body
 
- 
deserializepublic Object deserialize(io.nats.client.Message message, io.micronaut.core.type.Argument<Object> argument) Description copied from interface:NatsMessageSerDesDeserializes the message into the requested type.- Specified by:
- deserializein interface- NatsMessageSerDes<Object>
- Parameters:
- message- The message to deserialize
- argument- The type to be returned
- Returns:
- The deserialized body
 
- 
supportsDescription copied from interface:NatsMessageSerDesDetermines if this serdes supports the given type.- Specified by:
- supportsin interface- NatsMessageSerDes<Object>
- Parameters:
- argument- The type
- Returns:
- True if the type is supported
 
- 
getOrderpublic int getOrder()- Specified by:
- getOrderin interface- io.micronaut.core.order.Ordered
 
- 
findSerDesFinds the correct serDes based on the type.- Parameters:
- type- The java type
- Returns:
- The serdes, or null if none can be found
 
- 
getStringSerDes- Returns:
- The serDes that handles String
 
- 
getShortSerDes- Returns:
- The serDes that handles Short
 
- 
getIntegerSerDes- Returns:
- The serDes that handles Integer
 
- 
getLongSerDes- Returns:
- The serDes that handles Long
 
- 
getFloatSerDes- Returns:
- The serDes that handles Float
 
- 
getDoubleSerDes- Returns:
- The serDes that handles Double
 
- 
getByteArraySerDes- Returns:
- The serDes that handles byte[]
 
- 
getByteBufferSerDes- Returns:
- The serDes that handles ByteBuffer
 
- 
getUUIDSerDes- Returns:
- The serDes that handles UUID
 
- 
getBooleanSerDes- Returns:
- The serDes that handles UUID
 
 
-