@Test void testAsMessageReturnsProvidedMessageAsIs() { GenericMessage<String> testMessage = new GenericMessage<>("payload"); Message<?> result = GenericMessage.asMessage(testMessage); assertEquals(testMessage, result); }
public static Message<?> asMessage(Object payloadOrMessage) { if (payloadOrMessage instanceof Message) { return (Message<?>) payloadOrMessage; } else { return new GenericMessage<>(payloadOrMessage); } }
GenericMessage extends AbstractMessage<T> { public static Message<?> asMessage(Object payloadOrMessage) { if (payloadOrMessage instanceof Message) { return (Message<?>) payloadOrMessage; } else { return new GenericMessage<>(payloadOrMessage); } } }
GenericMessage extends AbstractMessage<T> { public static Message<?> asMessage(Object payloadOrMessage) { if (payloadOrMessage instanceof Message) { return (Message<?>) payloadOrMessage; } else { return new GenericMessage<>(payloadOrMessage); } } GenericMessage(T payload);  GenericMessage(T payload, Map<String, ?> metaData);  GenericMessage(Class<T> declaredPayloadType, T payload, Map<String, ?> metaData);  GenericMessage(String identifier, T payload, Map<String, ?> metaData);  GenericMessage(String identifier, Class<T> declaredPayloadType, T payload, Map<String, ?> metaData); private  GenericMessage(GenericMessage<T> original, MetaData metaData); }
GenericMessage extends AbstractMessage<T> { public static Message<?> asMessage(Object payloadOrMessage) { if (payloadOrMessage instanceof Message) { return (Message<?>) payloadOrMessage; } else { return new GenericMessage<>(payloadOrMessage); } } GenericMessage(T payload);  GenericMessage(T payload, Map<String, ?> metaData);  GenericMessage(Class<T> declaredPayloadType, T payload, Map<String, ?> metaData);  GenericMessage(String identifier, T payload, Map<String, ?> metaData);  GenericMessage(String identifier, Class<T> declaredPayloadType, T payload, Map<String, ?> metaData); private  GenericMessage(GenericMessage<T> original, MetaData metaData); static Message<?> asMessage(Object payloadOrMessage); @Override MetaData getMetaData(); @Override T getPayload(); @Override Class<T> getPayloadType(); @Override SerializedObject<R> serializePayload(Serializer serializer, Class<R> expectedRepresentation); @Override SerializedObject<R> serializeMetaData(Serializer serializer, Class<R> expectedRepresentation); }
GenericMessage extends AbstractMessage<T> { public static Message<?> asMessage(Object payloadOrMessage) { if (payloadOrMessage instanceof Message) { return (Message<?>) payloadOrMessage; } else { return new GenericMessage<>(payloadOrMessage); } } GenericMessage(T payload);  GenericMessage(T payload, Map<String, ?> metaData);  GenericMessage(Class<T> declaredPayloadType, T payload, Map<String, ?> metaData);  GenericMessage(String identifier, T payload, Map<String, ?> metaData);  GenericMessage(String identifier, Class<T> declaredPayloadType, T payload, Map<String, ?> metaData); private  GenericMessage(GenericMessage<T> original, MetaData metaData); static Message<?> asMessage(Object payloadOrMessage); @Override MetaData getMetaData(); @Override T getPayload(); @Override Class<T> getPayloadType(); @Override SerializedObject<R> serializePayload(Serializer serializer, Class<R> expectedRepresentation); @Override SerializedObject<R> serializeMetaData(Serializer serializer, Class<R> expectedRepresentation);  }