Class MetadataConverter
java.lang.Object
io.axoniq.framework.axonserver.connector.shared.MetadataConverter
Utility class to convert between Axon Server metadata values and a simple
Map of String key-value pairs.
This class provides methods to convert a Map of String key-value pairs to a Map of Axon Server
MetaDataValue objects and vice versa.
- Since:
- 5.0.0
- Author:
- Steven van Beelen, Mitchell Herrijgers, Allard Buijze
-
Method Summary
Modifier and TypeMethodDescriptionconvertGrpcToMetadataMap(Map<String, io.axoniq.axonserver.grpc.MetaDataValue> source) convertMetadataMapToGrpc(Map<String, @Nullable String> source)
-
Method Details
-
convertMetadataMapToGrpc
public static Map<String,io.axoniq.axonserver.grpc.MetaDataValue> convertMetadataMapToGrpc(Map<String, @Nullable String> source) - Parameters:
source- The source map containing String key-value pairs.- Returns:
- A map where each value is converted to an Axon Server
MetaDataValue.
-
convertGrpcToMetadataMap
public static Map<String,@Nullable String> convertGrpcToMetadataMap(Map<String, io.axoniq.axonserver.grpc.MetaDataValue> source) Converts aMapof Axon ServerMetaDataValueobjects to aMapof String key-value pairs.Text, double, number and boolean values are converted to their
Stringrepresentation. Abytes_value, which Axon Framework 4 used for anything that was not text, a number or a boolean, is converted by using its bytes as UTF-8 text, such as JSON or XML. When these bytes are not valid text, for example due to a binary serializer, the key is kept with anullvalue and a warning is logged once per key. AMetaDataValuewithout any value is converted to anullvalue as well, without a warning.- Parameters:
source- the source map containing Axon ServerMetaDataValueobjects- Returns:
- a map where each value is converted to a String representation, or
nullif it cannot be converted
-