Class ReviewBuilder

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

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

     Review review = Review.builder()
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .includedInStatistics(true)
             .build()
 
  • Constructor Details

    • ReviewBuilder

      public ReviewBuilder()
  • Method Details

    • id

      public ReviewBuilder id(String id)

      Unique identifier of the Review.

      Parameters:
      id - value to be set
      Returns:
      Builder
    • version

      public ReviewBuilder version(Long version)

      Current version of the Review.

      Parameters:
      version - value to be set
      Returns:
      Builder
    • createdAt

      public ReviewBuilder createdAt(ZonedDateTime createdAt)

      Date and time (UTC) the Review was initially created.

      Parameters:
      createdAt - value to be set
      Returns:
      Builder
    • lastModifiedAt

      public ReviewBuilder lastModifiedAt(ZonedDateTime lastModifiedAt)

      Date and time (UTC) the Review was last updated.

      Parameters:
      lastModifiedAt - value to be set
      Returns:
      Builder
    • lastModifiedBy

      IDs and references that last modified the Review.

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

      public ReviewBuilder withLastModifiedBy(Function<LastModifiedByBuilder,LastModifiedBy> builder)

      IDs and references that last modified the Review.

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

      public ReviewBuilder lastModifiedBy(@Nullable LastModifiedBy lastModifiedBy)

      IDs and references that last modified the Review.

      Parameters:
      lastModifiedBy - value to be set
      Returns:
      Builder
    • createdBy

      IDs and references that created the Review.

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

      public ReviewBuilder withCreatedBy(Function<CreatedByBuilder,CreatedBy> builder)

      IDs and references that created the Review.

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

      public ReviewBuilder createdBy(@Nullable CreatedBy createdBy)

      IDs and references that created the Review.

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

      public ReviewBuilder key(@Nullable String key)

      User-defined unique identifier of the Review.

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

      public ReviewBuilder uniquenessValue(@Nullable String uniquenessValue)

      Must be unique among Reviews. For example, if this value is set to Customer id + Product id, only one Review per Customer and per Product is allowed.

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

      public ReviewBuilder locale(@Nullable String locale)

      Language in which the content of the Review is written.

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

      public ReviewBuilder authorName(@Nullable String authorName)

      Name of the author.

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

      public ReviewBuilder title(@Nullable String title)

      Title of the Review.

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

      public ReviewBuilder text(@Nullable String text)

      Content of the Review.

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

      public ReviewBuilder target(@Nullable Reference target)

      A Reference represents a loose reference to another resource in the same Project identified by its id. The typeId indicates the type of the referenced resource. Each resource type has its corresponding Reference type, like ChannelReference. A referenced resource can be embedded through Reference Expansion. The expanded reference is the value of an additional obj field then.

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

      public ReviewBuilder target(Function<ReferenceBuilder,Builder<? extends Reference>> builder)

      A Reference represents a loose reference to another resource in the same Project identified by its id. The typeId indicates the type of the referenced resource. Each resource type has its corresponding Reference type, like ChannelReference. A referenced resource can be embedded through Reference Expansion. The expanded reference is the value of an additional obj field then.

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

      public ReviewBuilder includedInStatistics(Boolean includedInStatistics)

      Indicates if this Review is taken into account in the ratings statistics of the target. A Review is per default used in the statistics, unless the Review is in a state that does not have the role ReviewIncludedInStatistics. If the role of a State is modified after the calculation of this field, the calculation is not updated.

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

      public ReviewBuilder rating(@Nullable Integer rating)

      Rating of the Product or Channel.

      Parameters:
      rating - value to be set
      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

      public ReviewBuilder state(@Nullable StateReference state)

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

      Parameters:
      state - 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

      public ReviewBuilder customer(@Nullable CustomerReference customer)

      Customer who created the Review.

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

      Custom Fields of the Review.

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

      Custom Fields of the Review.

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

      public ReviewBuilder custom(@Nullable CustomFields custom)

      Custom Fields of the Review.

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

      public String getId()

      Unique identifier of the Review.

      Returns:
      id
    • getVersion

      public Long getVersion()

      Current version of the Review.

      Returns:
      version
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

      Date and time (UTC) the Review was initially created.

      Returns:
      createdAt
    • getLastModifiedAt

      public ZonedDateTime getLastModifiedAt()

      Date and time (UTC) the Review was last updated.

      Returns:
      lastModifiedAt
    • getLastModifiedBy

      @Nullable public LastModifiedBy getLastModifiedBy()

      IDs and references that last modified the Review.

      Returns:
      lastModifiedBy
    • getCreatedBy

      @Nullable public CreatedBy getCreatedBy()

      IDs and references that created the Review.

      Returns:
      createdBy
    • getKey

      @Nullable public String getKey()

      User-defined unique identifier of the Review.

      Returns:
      key
    • getUniquenessValue

      @Nullable public String getUniquenessValue()

      Must be unique among Reviews. For example, if this value is set to Customer id + Product id, only one Review per Customer and per Product is allowed.

      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 Reference getTarget()

      A Reference represents a loose reference to another resource in the same Project identified by its id. The typeId indicates the type of the referenced resource. Each resource type has its corresponding Reference type, like ChannelReference. A referenced resource can be embedded through Reference Expansion. The expanded reference is the value of an additional obj field then.

      Returns:
      target
    • getIncludedInStatistics

      public Boolean getIncludedInStatistics()

      Indicates if this Review is taken into account in the ratings statistics of the target. A Review is per default used in the statistics, unless the Review is in a state that does not have the role ReviewIncludedInStatistics. If the role of a State is modified after the calculation of this field, the calculation is not updated.

      Returns:
      includedInStatistics
    • getRating

      @Nullable public Integer getRating()

      Rating of the Product or Channel.

      Returns:
      rating
    • getState

      @Nullable public StateReference getState()

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

      Returns:
      state
    • getCustomer

      @Nullable public CustomerReference getCustomer()

      Customer who created the Review.

      Returns:
      customer
    • getCustom

      @Nullable public CustomFields getCustom()

      Custom Fields of the Review.

      Returns:
      custom
    • build

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

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

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

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