Class ShippingMethodBuilder

java.lang.Object
com.commercetools.api.models.shipping_method.ShippingMethodBuilder
All Implemented Interfaces:
Builder<ShippingMethod>

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

     ShippingMethod shippingMethod = ShippingMethod.builder()
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .name("{name}")
             .taxCategory(taxCategoryBuilder -> taxCategoryBuilder)
             .plusZoneRates(zoneRatesBuilder -> zoneRatesBuilder)
             .active(true)
             .isDefault(true)
             .build()
 
  • Constructor Details

    • ShippingMethodBuilder

      public ShippingMethodBuilder()
  • Method Details

    • id

      public ShippingMethodBuilder id(String id)

      Unique identifier of the ShippingMethod.

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

      public ShippingMethodBuilder version(Long version)

      Current version of the ShippingMethod.

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

      public ShippingMethodBuilder createdAt(ZonedDateTime createdAt)

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

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

      public ShippingMethodBuilder lastModifiedAt(ZonedDateTime lastModifiedAt)

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

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

      IDs and references that last modified the ShippingMethod.

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

      IDs and references that last modified the ShippingMethod.

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

      public ShippingMethodBuilder lastModifiedBy(@Nullable LastModifiedBy lastModifiedBy)

      IDs and references that last modified the ShippingMethod.

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

      IDs and references that created the ShippingMethod.

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

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

      IDs and references that created the ShippingMethod.

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

      public ShippingMethodBuilder createdBy(@Nullable CreatedBy createdBy)

      IDs and references that created the ShippingMethod.

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

      User-defined unique identifier of the ShippingMethod.

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

      public ShippingMethodBuilder name(String name)

      Unique name of the ShippingMethod within a Project.

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

      Localized name of the ShippingMethod.

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

      Localized name of the ShippingMethod.

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

      public ShippingMethodBuilder localizedName(@Nullable LocalizedString localizedName)

      Localized name of the ShippingMethod.

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

      @Deprecated public ShippingMethodBuilder description(@Nullable String description)
      Deprecated.

      Description of the ShippingMethod.

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

      Localized description of the ShippingMethod.

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

      public ShippingMethodBuilder withLocalizedDescription(Function<LocalizedStringBuilder,LocalizedString> builder)

      Localized description of the ShippingMethod.

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

      public ShippingMethodBuilder localizedDescription(@Nullable LocalizedString localizedDescription)

      Localized description of the ShippingMethod.

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

      TaxCategory of all ZoneRates of the ShippingMethod.

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

      TaxCategory of all ZoneRates of the ShippingMethod.

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

      public ShippingMethodBuilder taxCategory(TaxCategoryReference taxCategory)

      TaxCategory of all ZoneRates of the ShippingMethod.

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

      public ShippingMethodBuilder zoneRates(ZoneRate... zoneRates)

      Defines ShippingRates (prices) for specific Zones.

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

      public ShippingMethodBuilder zoneRates(List<ZoneRate> zoneRates)

      Defines ShippingRates (prices) for specific Zones.

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

      public ShippingMethodBuilder plusZoneRates(ZoneRate... zoneRates)

      Defines ShippingRates (prices) for specific Zones.

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

      Defines ShippingRates (prices) for specific Zones.

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

      Defines ShippingRates (prices) for specific Zones.

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

      public ShippingMethodBuilder addZoneRates(Function<ZoneRateBuilder,ZoneRate> builder)

      Defines ShippingRates (prices) for specific Zones.

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

      public ShippingMethodBuilder setZoneRates(Function<ZoneRateBuilder,ZoneRate> builder)

      Defines ShippingRates (prices) for specific Zones.

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

      public ShippingMethodBuilder active(Boolean active)

      Indicates if the ShippingMethod is active.

      If true, the ShippingMethod can be used during the creation or update of a Cart or Order.

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

      public ShippingMethodBuilder isDefault(Boolean isDefault)

      If true, this ShippingMethod is the Project's default ShippingMethod.

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

      public ShippingMethodBuilder predicate(@Nullable String predicate)

      Valid Cart predicate to select a ShippingMethod for a Cart.

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

      Custom Fields of the ShippingMethod.

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

      Custom Fields of the ShippingMethod.

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

      Custom Fields of the ShippingMethod.

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

      public String getId()

      Unique identifier of the ShippingMethod.

      Returns:
      id
    • getVersion

      public Long getVersion()

      Current version of the ShippingMethod.

      Returns:
      version
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

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

      Returns:
      createdAt
    • getLastModifiedAt

      public ZonedDateTime getLastModifiedAt()

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

      Returns:
      lastModifiedAt
    • getLastModifiedBy

      @Nullable public LastModifiedBy getLastModifiedBy()

      IDs and references that last modified the ShippingMethod.

      Returns:
      lastModifiedBy
    • getCreatedBy

      @Nullable public CreatedBy getCreatedBy()

      IDs and references that created the ShippingMethod.

      Returns:
      createdBy
    • getKey

      @Nullable public String getKey()

      User-defined unique identifier of the ShippingMethod.

      Returns:
      key
    • getName

      public String getName()

      Unique name of the ShippingMethod within a Project.

      Returns:
      name
    • getLocalizedName

      @Nullable public LocalizedString getLocalizedName()

      Localized name of the ShippingMethod.

      Returns:
      localizedName
    • getDescription

      @Deprecated @Nullable public String getDescription()
      Deprecated.

      Description of the ShippingMethod.

      Returns:
      description
    • getLocalizedDescription

      @Nullable public LocalizedString getLocalizedDescription()

      Localized description of the ShippingMethod.

      Returns:
      localizedDescription
    • getTaxCategory

      public TaxCategoryReference getTaxCategory()

      TaxCategory of all ZoneRates of the ShippingMethod.

      Returns:
      taxCategory
    • getZoneRates

      public List<ZoneRate> getZoneRates()

      Defines ShippingRates (prices) for specific Zones.

      Returns:
      zoneRates
    • getActive

      public Boolean getActive()

      Indicates if the ShippingMethod is active.

      If true, the ShippingMethod can be used during the creation or update of a Cart or Order.

      Returns:
      active
    • getIsDefault

      public Boolean getIsDefault()

      If true, this ShippingMethod is the Project's default ShippingMethod.

      Returns:
      isDefault
    • getPredicate

      @Nullable public String getPredicate()

      Valid Cart predicate to select a ShippingMethod for a Cart.

      Returns:
      predicate
    • getCustom

      @Nullable public CustomFields getCustom()

      Custom Fields of the ShippingMethod.

      Returns:
      custom
    • build

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

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

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

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