Package io.micronaut.rabbitmq.serdes
Class JavaLangRabbitMessageSerDes
java.lang.Object
io.micronaut.rabbitmq.serdes.JavaLangRabbitMessageSerDes
- All Implemented Interfaces:
io.micronaut.core.order.Ordered,RabbitMessageSerDes<Object>
@Singleton
public class JavaLangRabbitMessageSerDes
extends Object
implements RabbitMessageSerDes<Object>
Serializes and deserializes standard Java types.
- Since:
- 1.1.0
- Author:
- James Kleeh
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List<RabbitMessageSerDes>static final IntegerThe order of this serDes.Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(RabbitConsumerState messageState, io.micronaut.core.type.Argument<Object> argument) Deserializes the message into the requested type.protected @Nullable RabbitMessageSerDesfindSerDes(io.micronaut.core.type.Argument<?> type) Finds the correct serDes based on the type.protected @NonNull RabbitMessageSerDes<Boolean>protected @NonNull RabbitMessageSerDes<byte[]>protected @NonNull RabbitMessageSerDes<ByteBuffer>protected @NonNull RabbitMessageSerDes<Double>protected @NonNull RabbitMessageSerDes<Float>protected @NonNull RabbitMessageSerDes<Integer>protected @NonNull RabbitMessageSerDes<Long>intgetOrder()protected @NonNull RabbitMessageSerDes<Short>protected @NonNull RabbitMessageSerDes<String>protected @NonNull RabbitMessageSerDes<UUID>byte[]serialize(@Nullable Object data, MutableBasicProperties properties) Serializes the data into a byte[] to be published to RabbitMQ.booleanDetermines if this serdes supports the given type.
-
Field Details
-
ORDER
The order of this serDes. -
javaSerDes
-
-
Constructor Details
-
JavaLangRabbitMessageSerDes
public JavaLangRabbitMessageSerDes()Default constructor.
-
-
Method Details
-
serialize
Description copied from interface:RabbitMessageSerDesSerializes the data into a byte[] to be published to RabbitMQ.- Specified by:
serializein interfaceRabbitMessageSerDes<Object>- Parameters:
data- The data to serializeproperties- The properties of the message- Returns:
- The message body
-
deserialize
public Object deserialize(RabbitConsumerState messageState, io.micronaut.core.type.Argument<Object> argument) Description copied from interface:RabbitMessageSerDesDeserializes the message into the requested type.- Specified by:
deserializein interfaceRabbitMessageSerDes<Object>- Parameters:
messageState- The message to deserializeargument- The type to be returned- Returns:
- The deserialized body
-
supports
Description copied from interface:RabbitMessageSerDesDetermines if this serdes supports the given type.- Specified by:
supportsin interfaceRabbitMessageSerDes<Object>- Parameters:
argument- The type- Returns:
- True if the type is supported
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceio.micronaut.core.order.Ordered
-
findSerDes
@Nullable protected @Nullable RabbitMessageSerDes findSerDes(io.micronaut.core.type.Argument<?> type) Finds 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
-