public class GrpcMetaDataConverter extends Object
To optimize communication and minimize the loss of data structure, the MetaDataValue entries used in gRPC distinguish
between numerical values (double or long), Strings, booleans and arbitrary objects. The latter group is converted to
and from a byte[]
using the configured Serializer.
Constructor and Description |
---|
GrpcMetaDataConverter(Serializer serializer)
Initialize the converter, using the given
serializer to serialize Objects. |
Modifier and Type | Method and Description |
---|---|
MetaData |
convert(Map<String,io.axoniq.axonserver.grpc.MetaDataValue> metaDataMap)
Convert the given
Map of MetaDataValue s to a Map containing the Java representations of each of
those values. |
Object |
convertFromMetaDataValue(io.axoniq.axonserver.grpc.MetaDataValue value)
Convert the given
MetaDataValue to its Java representation. |
io.axoniq.axonserver.grpc.MetaDataValue |
convertToMetaDataValue(Object value)
Convert the given
value into a MetaDataValue , attempting to maintain the source type as much as
possible in the returned MetaDataValue . |
public GrpcMetaDataConverter(Serializer serializer)
serializer
to serialize Objects.serializer
- the Serializer
to serialize objects withpublic io.axoniq.axonserver.grpc.MetaDataValue convertToMetaDataValue(Object value)
value
into a MetaDataValue
, attempting to maintain the source type as much as
possible in the returned MetaDataValue
.
value
- the Object
to convert into a MetaDataValue
MetaDataValue
representing the given value
public MetaData convert(Map<String,io.axoniq.axonserver.grpc.MetaDataValue> metaDataMap)
Map
of MetaDataValue
s to a Map containing the Java representations of each of
those values.
See convertToMetaDataValue(Object)
for details about the mapping.
public Object convertFromMetaDataValue(io.axoniq.axonserver.grpc.MetaDataValue value)
MetaDataValue
to its Java representation.
See convertToMetaDataValue(Object)
for details about the mapping.
value
- the MetaDataValue
to convert to its Java representationObject
representing the same valueCopyright © 2010–2020. All rights reserved.