public interface Message extends Resource<Message>
MessageQuery
how to use messages.Modifier and Type | Method and Description |
---|---|
<T> T |
as(Class<T> messageClass) |
com.fasterxml.jackson.databind.JsonNode |
getPayload()
Gets the top level fields not mapped by the current message class.
|
Reference<?> |
getResource() |
UserProvidedIdentifiers |
getResourceUserProvidedIdentifiers() |
Long |
getResourceVersion() |
Long |
getSequenceNumber() |
String |
getType() |
static Reference<Message> |
referenceOfId(String id)
Creates a reference for one item of this class by a known ID.
|
static String |
referenceTypeId()
A type hint for references which resource type is linked in a reference.
|
default Reference<Message> |
toReference()
Creates a reference to this resource, the reference may not be filled.
|
static com.fasterxml.jackson.core.type.TypeReference<Message> |
typeReference()
Creates a container which contains the full Java type information to deserialize this class from JSON.
|
getCreatedAt, getId, getLastModifiedAt, getVersion
hasSameIdAs, toResourceIdentifier
static String referenceTypeId()
Reference.getTypeId()
static com.fasterxml.jackson.core.type.TypeReference<Message> typeReference()
Reference<?> getResource()
Long getResourceVersion()
Long getSequenceNumber()
String getType()
@Nullable UserProvidedIdentifiers getResourceUserProvidedIdentifiers()
com.fasterxml.jackson.databind.JsonNode getPayload()
default Reference<Message> toReference()
Referenceable
toReference
in interface Referenceable<Message>
toReference
in interface Resource<Message>
<T> T as(Class<T> messageClass)
static Reference<Message> referenceOfId(String id)
An example for categories but this applies for other resources, too:
final String categoryIdFromFormOrSession = "84ac4271-0fec-49d0-9fee-55586c565c58"; final Reference<Category> categoryReference = Category.referenceOfId(categoryIdFromFormOrSession); assertThat(categoryReference.getId()).isEqualTo(categoryIdFromFormOrSession);
See the test code.
If you already have a resource object, then use toReference()
instead:
final Category category = getCategory1(); final Reference<Category> categoryReference = category.toReference(); assertThat(category.getId()).isEqualTo(categoryReference.getId());
See the test code.
id
- the ID of the resource which should be referenced.