Class ScopedPriceBuilder

java.lang.Object
com.commercetools.api.models.common.ScopedPriceBuilder
All Implemented Interfaces:
Builder<ScopedPrice>

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

     ScopedPrice scopedPrice = ScopedPrice.builder()
             .id("{id}")
             .value(valueBuilder -> valueBuilder)
             .currentValue(currentValueBuilder -> currentValueBuilder)
             .build()
 
  • Constructor Details

    • ScopedPriceBuilder

      public ScopedPriceBuilder()
  • Method Details

    • id

      public ScopedPriceBuilder id(String id)

      Platform-generated unique identifier of the Price.

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

      public ScopedPriceBuilder value(TypedMoney value)

      Original value of the Price.

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

      public ScopedPriceBuilder value(Function<TypedMoneyBuilder,Builder<? extends TypedMoney>> builder)

      Original value of the Price.

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

      public ScopedPriceBuilder currentValue(TypedMoney currentValue)

      If available, either the original price value or discounted value.

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

      public ScopedPriceBuilder currentValue(Function<TypedMoneyBuilder,Builder<? extends TypedMoney>> builder)

      If available, either the original price value or discounted value.

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

      public ScopedPriceBuilder country(@Nullable String country)

      Country code of the geographic location.

      Parameters:
      country - value to be set
      Returns:
      Builder
    • customerGroup

      Reference to a CustomerGroup.

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

      Reference to a CustomerGroup.

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

      public ScopedPriceBuilder customerGroup(@Nullable CustomerGroupReference customerGroup)

      Reference to a CustomerGroup.

      Parameters:
      customerGroup - value to be set
      Returns:
      Builder
    • channel

      Reference to a Channel.

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

      Reference to a Channel.

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

      public ScopedPriceBuilder channel(@Nullable ChannelReference channel)

      Reference to a Channel.

      Parameters:
      channel - value to be set
      Returns:
      Builder
    • validFrom

      public ScopedPriceBuilder validFrom(@Nullable ZonedDateTime validFrom)

      Date and time from which the Price is valid.

      Parameters:
      validFrom - value to be set
      Returns:
      Builder
    • validUntil

      public ScopedPriceBuilder validUntil(@Nullable ZonedDateTime validUntil)

      Date and time until which the Price is valid.

      Parameters:
      validUntil - value to be set
      Returns:
      Builder
    • discounted

      Is set when a matching ProductDiscount exists. If set, the Cart uses the discounted value for the Cart Price calculation.

      When a relative Product Discount is applied and the fractional part of the discounted Price is 0.5, the discounted Price is rounded half down in favor of the Customer.

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

      Is set when a matching ProductDiscount exists. If set, the Cart uses the discounted value for the Cart Price calculation.

      When a relative Product Discount is applied and the fractional part of the discounted Price is 0.5, the discounted Price is rounded half down in favor of the Customer.

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

      public ScopedPriceBuilder discounted(@Nullable DiscountedPrice discounted)

      Is set when a matching ProductDiscount exists. If set, the Cart uses the discounted value for the Cart Price calculation.

      When a relative Product Discount is applied and the fractional part of the discounted Price is 0.5, the discounted Price is rounded half down in favor of the Customer.

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

      Custom Fields for the Price.

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

      Custom Fields for the Price.

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

      public ScopedPriceBuilder custom(@Nullable CustomFields custom)

      Custom Fields for the Price.

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

      public String getId()

      Platform-generated unique identifier of the Price.

      Returns:
      id
    • getValue

      public TypedMoney getValue()

      Original value of the Price.

      Returns:
      value
    • getCurrentValue

      public TypedMoney getCurrentValue()

      If available, either the original price value or discounted value.

      Returns:
      currentValue
    • getCountry

      @Nullable public String getCountry()

      Country code of the geographic location.

      Returns:
      country
    • getCustomerGroup

      @Nullable public CustomerGroupReference getCustomerGroup()

      Reference to a CustomerGroup.

      Returns:
      customerGroup
    • getChannel

      @Nullable public ChannelReference getChannel()

      Reference to a Channel.

      Returns:
      channel
    • getValidFrom

      @Nullable public ZonedDateTime getValidFrom()

      Date and time from which the Price is valid.

      Returns:
      validFrom
    • getValidUntil

      @Nullable public ZonedDateTime getValidUntil()

      Date and time until which the Price is valid.

      Returns:
      validUntil
    • getDiscounted

      @Nullable public DiscountedPrice getDiscounted()

      Is set when a matching ProductDiscount exists. If set, the Cart uses the discounted value for the Cart Price calculation.

      When a relative Product Discount is applied and the fractional part of the discounted Price is 0.5, the discounted Price is rounded half down in favor of the Customer.

      Returns:
      discounted
    • getCustom

      @Nullable public CustomFields getCustom()

      Custom Fields for the Price.

      Returns:
      custom
    • build

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

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

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

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