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 of
those values. |
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 Objects.serializer - the Serializer 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 Object to convert into a MetaDataValueMetaDataValue representing the given valuepublic MetaData convert(Map<String,MetaDataValue> metaDataMap)
Map of MetaDataValues to a Map containing the Java representations of each of
those values.
See convertToMetaDataValue(Object) for details about the mapping.
metaDataMap - a Map containing MetaDataValue representations of each MetaData keyMetaData map containing the same keys, referencing to the Java representation of each
corresponding value in the given metaDataMappublic Object convertFromMetaDataValue(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–2019. All rights reserved.