@Test void testConvertStringToMetaDataValue() { String testValue = "some-text"; MetaDataValue result = testSubject.convertToMetaDataValue(testValue); assertEquals(testValue, result.getTextValue()); }
public MetaDataValue convertToMetaDataValue(Object value) { MetaDataValue.Builder builder = MetaDataValue.newBuilder(); if (value instanceof CharSequence) { builder.setTextValue(value.toString()); } else if (value instanceof Double || value instanceof Float) { builder.setDoubleValue(((Number) value).doubleValue()); } else if (value instanceof Number) { builder.setNumberValue(((Number) value).longValue()); } else if (value instanceof Boolean) { builder.setBooleanValue((Boolean) value); } else { SerializedObject<byte[]> serializedObject = serializer.serialize(value, byte[].class); SerializedType serializedType = serializedObject.getType(); if (!SerializedType.isEmptyType(serializedType)) { builder.setBytesValue(io.axoniq.axonserver.grpc.SerializedObject .newBuilder() .setType(serializedType.getName()) .setData(ByteString.copyFrom(serializedObject.getData())) .setRevision(getOrDefault(serializedType.getRevision(), "")) .build()); } } return builder.build(); }
GrpcMetaDataConverter { public MetaDataValue convertToMetaDataValue(Object value) { MetaDataValue.Builder builder = MetaDataValue.newBuilder(); if (value instanceof CharSequence) { builder.setTextValue(value.toString()); } else if (value instanceof Double || value instanceof Float) { builder.setDoubleValue(((Number) value).doubleValue()); } else if (value instanceof Number) { builder.setNumberValue(((Number) value).longValue()); } else if (value instanceof Boolean) { builder.setBooleanValue((Boolean) value); } else { SerializedObject<byte[]> serializedObject = serializer.serialize(value, byte[].class); SerializedType serializedType = serializedObject.getType(); if (!SerializedType.isEmptyType(serializedType)) { builder.setBytesValue(io.axoniq.axonserver.grpc.SerializedObject .newBuilder() .setType(serializedType.getName()) .setData(ByteString.copyFrom(serializedObject.getData())) .setRevision(getOrDefault(serializedType.getRevision(), "")) .build()); } } return builder.build(); } }
GrpcMetaDataConverter { public MetaDataValue convertToMetaDataValue(Object value) { MetaDataValue.Builder builder = MetaDataValue.newBuilder(); if (value instanceof CharSequence) { builder.setTextValue(value.toString()); } else if (value instanceof Double || value instanceof Float) { builder.setDoubleValue(((Number) value).doubleValue()); } else if (value instanceof Number) { builder.setNumberValue(((Number) value).longValue()); } else if (value instanceof Boolean) { builder.setBooleanValue((Boolean) value); } else { SerializedObject<byte[]> serializedObject = serializer.serialize(value, byte[].class); SerializedType serializedType = serializedObject.getType(); if (!SerializedType.isEmptyType(serializedType)) { builder.setBytesValue(io.axoniq.axonserver.grpc.SerializedObject .newBuilder() .setType(serializedType.getName()) .setData(ByteString.copyFrom(serializedObject.getData())) .setRevision(getOrDefault(serializedType.getRevision(), "")) .build()); } } return builder.build(); } GrpcMetaDataConverter(Serializer serializer); }
GrpcMetaDataConverter { public MetaDataValue convertToMetaDataValue(Object value) { MetaDataValue.Builder builder = MetaDataValue.newBuilder(); if (value instanceof CharSequence) { builder.setTextValue(value.toString()); } else if (value instanceof Double || value instanceof Float) { builder.setDoubleValue(((Number) value).doubleValue()); } else if (value instanceof Number) { builder.setNumberValue(((Number) value).longValue()); } else if (value instanceof Boolean) { builder.setBooleanValue((Boolean) value); } else { SerializedObject<byte[]> serializedObject = serializer.serialize(value, byte[].class); SerializedType serializedType = serializedObject.getType(); if (!SerializedType.isEmptyType(serializedType)) { builder.setBytesValue(io.axoniq.axonserver.grpc.SerializedObject .newBuilder() .setType(serializedType.getName()) .setData(ByteString.copyFrom(serializedObject.getData())) .setRevision(getOrDefault(serializedType.getRevision(), "")) .build()); } } return builder.build(); } GrpcMetaDataConverter(Serializer serializer); MetaDataValue convertToMetaDataValue(Object value); MetaData convert(Map<String, MetaDataValue> metaDataMap); Object convertFromMetaDataValue(MetaDataValue value); }
GrpcMetaDataConverter { public MetaDataValue convertToMetaDataValue(Object value) { MetaDataValue.Builder builder = MetaDataValue.newBuilder(); if (value instanceof CharSequence) { builder.setTextValue(value.toString()); } else if (value instanceof Double || value instanceof Float) { builder.setDoubleValue(((Number) value).doubleValue()); } else if (value instanceof Number) { builder.setNumberValue(((Number) value).longValue()); } else if (value instanceof Boolean) { builder.setBooleanValue((Boolean) value); } else { SerializedObject<byte[]> serializedObject = serializer.serialize(value, byte[].class); SerializedType serializedType = serializedObject.getType(); if (!SerializedType.isEmptyType(serializedType)) { builder.setBytesValue(io.axoniq.axonserver.grpc.SerializedObject .newBuilder() .setType(serializedType.getName()) .setData(ByteString.copyFrom(serializedObject.getData())) .setRevision(getOrDefault(serializedType.getRevision(), "")) .build()); } } return builder.build(); } GrpcMetaDataConverter(Serializer serializer); MetaDataValue convertToMetaDataValue(Object value); MetaData convert(Map<String, MetaDataValue> metaDataMap); Object convertFromMetaDataValue(MetaDataValue value);  }