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

io.sphere.sdk.reviews.Review Maven / Gradle / Ivy

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

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

import javax.annotation.Nullable;

/**
 Review of a product by a customer. A customer can create only one review per product.
 */
@JsonDeserialize(as = ReviewImpl.class)
public interface Review extends Resource {

    String getProductId();

    String getCustomerId();

    @Nullable
    String getAuthorName();

    @Nullable
    String getTitle();

    @Nullable
    String getText();

    @Nullable
    Double getScore();

    /**
     * Returns this state of this Review.
     *
     * @return state of this review or null
     *
     * @see io.sphere.sdk.reviews.commands.updateactions.TransitionState
     */
    @Nullable
    Reference getState();

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

    static String referenceTypeId() {
        return "review";
    }

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy