Class ReviewDraftBuilder

java.lang.Object
com.commercetools.api.models.review.ReviewDraftBuilder
All Implemented Interfaces:
Builder<ReviewDraft>

public class ReviewDraftBuilder extends Object implements Builder<ReviewDraft>
ReviewDraftBuilder
Example to create an instance using the builder pattern

     ReviewDraft reviewDraft = ReviewDraft.builder()
             .build()
 
  • Constructor Details

    • ReviewDraftBuilder

      public ReviewDraftBuilder()
  • Method Details

    • key

      User-defined unique identifier for the Review.

      Parameters:
      key - value to be set
      Returns:
      Builder
    • uniquenessValue

      public ReviewDraftBuilder uniquenessValue(@Nullable String uniquenessValue)

      If set, this value must be unique among Reviews. For example, if you want to have only one Review per Customer and per Product, you can set the value to Customer id + Product id.

      Parameters:
      uniquenessValue - value to be set
      Returns:
      Builder
    • locale

      public ReviewDraftBuilder locale(@Nullable String locale)

      Language in which the content of the Review is written.

      Parameters:
      locale - value to be set
      Returns:
      Builder
    • authorName

      public ReviewDraftBuilder authorName(@Nullable String authorName)

      Name of the author.

      Parameters:
      authorName - value to be set
      Returns:
      Builder
    • title

      public ReviewDraftBuilder title(@Nullable String title)

      Title of the Review.

      Parameters:
      title - value to be set
      Returns:
      Builder
    • text

      public ReviewDraftBuilder text(@Nullable String text)

      Content of the Review.

      Parameters:
      text - value to be set
      Returns:
      Builder
    • target

      Draft type to create a Reference or a KeyReference to a resource. Provide either the id or (wherever supported) the key of the resource to reference, but depending on the API endpoint the response returns either a Reference or a KeyReference. For example, the field parent of a CategoryDraft takes a ResourceIdentifier for its value while the value of the corresponding field of a Category is a Reference.

      Each resource type has its corresponding ResourceIdentifier, like ChannelResourceIdentifier.

      Parameters:
      target - value to be set
      Returns:
      Builder
    • target

      Draft type to create a Reference or a KeyReference to a resource. Provide either the id or (wherever supported) the key of the resource to reference, but depending on the API endpoint the response returns either a Reference or a KeyReference. For example, the field parent of a CategoryDraft takes a ResourceIdentifier for its value while the value of the corresponding field of a Category is a Reference.

      Each resource type has its corresponding ResourceIdentifier, like ChannelResourceIdentifier.

      Parameters:
      builder - function to build the target value
      Returns:
      Builder
    • state

      State of the Review. Used for approval processes, see Review approval process for details.

      Parameters:
      builder - function to build the state value
      Returns:
      Builder
    • withState

      State of the Review. Used for approval processes, see Review approval process for details.

      Parameters:
      builder - function to build the state value
      Returns:
      Builder
    • state

      State of the Review. Used for approval processes, see Review approval process for details.

      Parameters:
      state - value to be set
      Returns:
      Builder
    • rating

      public ReviewDraftBuilder rating(@Nullable Integer rating)

      Rating of the targeted Product or Channel. This rating can represent the number of stars, a percentage, or a like (+1)/dislike (-1). A rating is used in the ratings statistics of the targeted object, unless the Review is in a State that does not have the role ReviewIncludedInStatistics.

      Parameters:
      rating - value to be set
      Returns:
      Builder
    • customer

      Customer who created the Review.

      Parameters:
      builder - function to build the customer value
      Returns:
      Builder
    • withCustomer

      Customer who created the Review.

      Parameters:
      builder - function to build the customer value
      Returns:
      Builder
    • customer

      Customer who created the Review.

      Parameters:
      customer - value to be set
      Returns:
      Builder
    • custom

      Custom Fields for the Review.

      Parameters:
      builder - function to build the custom value
      Returns:
      Builder
    • withCustom

      Custom Fields for the Review.

      Parameters:
      builder - function to build the custom value
      Returns:
      Builder
    • custom

      Custom Fields for the Review.

      Parameters:
      custom - value to be set
      Returns:
      Builder
    • getKey

      @Nullable public String getKey()

      User-defined unique identifier for the Review.

      Returns:
      key
    • getUniquenessValue

      @Nullable public String getUniquenessValue()

      If set, this value must be unique among Reviews. For example, if you want to have only one Review per Customer and per Product, you can set the value to Customer id + Product id.

      Returns:
      uniquenessValue
    • getLocale

      @Nullable public String getLocale()

      Language in which the content of the Review is written.

      Returns:
      locale
    • getAuthorName

      @Nullable public String getAuthorName()

      Name of the author.

      Returns:
      authorName
    • getTitle

      @Nullable public String getTitle()

      Title of the Review.

      Returns:
      title
    • getText

      @Nullable public String getText()

      Content of the Review.

      Returns:
      text
    • getTarget

      @Nullable public ResourceIdentifier getTarget()

      Draft type to create a Reference or a KeyReference to a resource. Provide either the id or (wherever supported) the key of the resource to reference, but depending on the API endpoint the response returns either a Reference or a KeyReference. For example, the field parent of a CategoryDraft takes a ResourceIdentifier for its value while the value of the corresponding field of a Category is a Reference.

      Each resource type has its corresponding ResourceIdentifier, like ChannelResourceIdentifier.

      Returns:
      target
    • getState

      State of the Review. Used for approval processes, see Review approval process for details.

      Returns:
      state
    • getRating

      @Nullable public Integer getRating()

      Rating of the targeted Product or Channel. This rating can represent the number of stars, a percentage, or a like (+1)/dislike (-1). A rating is used in the ratings statistics of the targeted object, unless the Review is in a State that does not have the role ReviewIncludedInStatistics.

      Returns:
      rating
    • getCustomer

      @Nullable public CustomerResourceIdentifier getCustomer()

      Customer who created the Review.

      Returns:
      customer
    • getCustom

      @Nullable public CustomFieldsDraft getCustom()

      Custom Fields for the Review.

      Returns:
      custom
    • build

      public ReviewDraft build()
      builds ReviewDraft with checking for non-null required values
      Specified by:
      build in interface Builder<ReviewDraft>
      Returns:
      ReviewDraft
    • buildUnchecked

      public ReviewDraft buildUnchecked()
      builds ReviewDraft without checking for non-null required values
      Returns:
      ReviewDraft
    • of

      public static ReviewDraftBuilder of()
      factory method for an instance of ReviewDraftBuilder
      Returns:
      builder
    • of

      public static ReviewDraftBuilder of(ReviewDraft template)
      create builder for ReviewDraft instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder