All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.messages.Message Maven / Gradle / Ivy

There is a newer version: 1.0.0-M26
Show newest version
package io.sphere.sdk.messages;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.sphere.sdk.models.Resource;
import io.sphere.sdk.models.Reference;

@JsonDeserialize(as = MessageImpl.class)
public interface Message extends Resource {
    static String referenceTypeId() {
        return "message";
    }

    /**
     *
     * @deprecated use {@link #referenceTypeId()} instead
     * @return referenceTypeId
     */
    @Deprecated
    static String typeId(){
        return "message";
    }

    static TypeReference typeReference(){
        return new TypeReference() {
            @Override
            public String toString() {
                return "TypeReference";
            }
        };
    }

    Reference getResource();

    Long getResourceVersion();

    Long getSequenceNumber();

    String getType();

    /**
     * Gets the top level fields not mapped by the current message class.
     * @return json
     */
    JsonNode getPayload();

    @Override
    default Reference toReference() {
        return Reference.of(Message.referenceTypeId(), getId());
    }

     T as(final Class messageClass);


    static Reference referenceOfId(final String id) {
        return Reference.of(referenceTypeId(), id);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy