@Test void testSerializeMetaDataImmediately() { SerializedMessage<Object> message = new SerializedMessage<>(eventId, serializedPayload, serializedMetaData, serializer); SerializedObject<byte[]> actual = message.serializeMetaData(serializer, byte[].class); assertArrayEquals("serializedMetaData".getBytes(Charset.forName("UTF-8")), actual.getData()); verify(serializer, atLeast(0)).classForType(isA(SerializedType.class)); verify(serializer, atLeast(0)).getConverter(); verifyNoMoreInteractions(serializer); }
@SuppressWarnings("unchecked") @Override public <R> SerializedObject<R> serializeMetaData(Serializer serializer, Class<R> expectedRepresentation) { if (serializer.equals(metaData.getSerializer())) { return serializer.getConverter().convert(metaData.getSerializedObject(), expectedRepresentation); } return serializer.serialize(metaData.getObject(), expectedRepresentation); }
SerializedMessage extends AbstractMessage<T> { @SuppressWarnings("unchecked") @Override public <R> SerializedObject<R> serializeMetaData(Serializer serializer, Class<R> expectedRepresentation) { if (serializer.equals(metaData.getSerializer())) { return serializer.getConverter().convert(metaData.getSerializedObject(), expectedRepresentation); } return serializer.serialize(metaData.getObject(), expectedRepresentation); } }
SerializedMessage extends AbstractMessage<T> { @SuppressWarnings("unchecked") @Override public <R> SerializedObject<R> serializeMetaData(Serializer serializer, Class<R> expectedRepresentation) { if (serializer.equals(metaData.getSerializer())) { return serializer.getConverter().convert(metaData.getSerializedObject(), expectedRepresentation); } return serializer.serialize(metaData.getObject(), expectedRepresentation); } SerializedMessage(String identifier, SerializedObject<?> serializedPayload,
                             SerializedObject<?> serializedMetaData, Serializer serializer);  SerializedMessage(String identifier, LazyDeserializingObject<T> payload,
                             LazyDeserializingObject<MetaData> metaData); private  SerializedMessage(SerializedMessage<T> message, LazyDeserializingObject<MetaData> newMetaData); }
SerializedMessage extends AbstractMessage<T> { @SuppressWarnings("unchecked") @Override public <R> SerializedObject<R> serializeMetaData(Serializer serializer, Class<R> expectedRepresentation) { if (serializer.equals(metaData.getSerializer())) { return serializer.getConverter().convert(metaData.getSerializedObject(), expectedRepresentation); } return serializer.serialize(metaData.getObject(), expectedRepresentation); } SerializedMessage(String identifier, SerializedObject<?> serializedPayload,
                             SerializedObject<?> serializedMetaData, Serializer serializer);  SerializedMessage(String identifier, LazyDeserializingObject<T> payload,
                             LazyDeserializingObject<MetaData> metaData); private  SerializedMessage(SerializedMessage<T> message, LazyDeserializingObject<MetaData> newMetaData); @Override T getPayload(); @Override MetaData getMetaData(); @Override Class<T> getPayloadType(); @Override SerializedMessage<T> withMetaData(Map<String, ?> metaData); @Override SerializedMessage<T> andMetaData(Map<String, ?> metaData); @SuppressWarnings("unchecked") @Override SerializedObject<R> serializePayload(Serializer serializer, Class<R> expectedRepresentation); @SuppressWarnings("unchecked") @Override SerializedObject<R> serializeMetaData(Serializer serializer, Class<R> expectedRepresentation); boolean isPayloadDeserialized(); boolean isMetaDataDeserialized(); }
SerializedMessage extends AbstractMessage<T> { @SuppressWarnings("unchecked") @Override public <R> SerializedObject<R> serializeMetaData(Serializer serializer, Class<R> expectedRepresentation) { if (serializer.equals(metaData.getSerializer())) { return serializer.getConverter().convert(metaData.getSerializedObject(), expectedRepresentation); } return serializer.serialize(metaData.getObject(), expectedRepresentation); } SerializedMessage(String identifier, SerializedObject<?> serializedPayload,
                             SerializedObject<?> serializedMetaData, Serializer serializer);  SerializedMessage(String identifier, LazyDeserializingObject<T> payload,
                             LazyDeserializingObject<MetaData> metaData); private  SerializedMessage(SerializedMessage<T> message, LazyDeserializingObject<MetaData> newMetaData); @Override T getPayload(); @Override MetaData getMetaData(); @Override Class<T> getPayloadType(); @Override SerializedMessage<T> withMetaData(Map<String, ?> metaData); @Override SerializedMessage<T> andMetaData(Map<String, ?> metaData); @SuppressWarnings("unchecked") @Override SerializedObject<R> serializePayload(Serializer serializer, Class<R> expectedRepresentation); @SuppressWarnings("unchecked") @Override SerializedObject<R> serializeMetaData(Serializer serializer, Class<R> expectedRepresentation); boolean isPayloadDeserialized(); boolean isMetaDataDeserialized();  }