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,MetaDataValue> metaDataMap)
Convert the given map of MetaDataValues to a Map containing the Java representations of each MetaDataValue.
|
Object |
convertFromMetaDataValue(MetaDataValue value)
Convert the given MetaDataValue to its Java representation.
|
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 Objectsserializer
- The serialize to serialize objects withpublic MetaDataValue convertToMetaDataValue(Object value)
value
into a MetaDataValue
, attempting to maintain the source type as much as
possible in the returned MetaDataValue
.
value
- The value to convertpublic MetaData convert(Map<String,MetaDataValue> metaDataMap)
See convertToMetaDataValue(Object)
for details about the mapping.
metaDataMap
- a Map containing MetaDataValue representations of each MetaData keymetaDataMap
public Object convertFromMetaDataValue(MetaDataValue value)
See convertToMetaDataValue(Object)
for details about the mapping.
value
- The value to convertCopyright © 2010–2018. All rights reserved.