Class ZoneBuilder

java.lang.Object
com.commercetools.api.models.zone.ZoneBuilder
All Implemented Interfaces:
Builder<Zone>

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

     Zone zone = Zone.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}")
             .plusLocations(locationsBuilder -> locationsBuilder)
             .build()
 
  • Constructor Details

    • ZoneBuilder

      public ZoneBuilder()
  • Method Details

    • id

      public ZoneBuilder id(String id)

      Unique identifier of the Zone.

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

      public ZoneBuilder version(Long version)

      Current version of the Zone.

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

      public ZoneBuilder createdAt(ZonedDateTime createdAt)

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

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

      public ZoneBuilder lastModifiedAt(ZonedDateTime lastModifiedAt)

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

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

      IDs and references that last modified the Zone.

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

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

      IDs and references that last modified the Zone.

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

      public ZoneBuilder lastModifiedBy(@Nullable LastModifiedBy lastModifiedBy)

      IDs and references that last modified the Zone.

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

      IDs and references that created the Zone.

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

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

      IDs and references that created the Zone.

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

      public ZoneBuilder createdBy(@Nullable CreatedBy createdBy)

      IDs and references that created the Zone.

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

      public ZoneBuilder key(@Nullable String key)

      User-defined unique identifier of the Zone.

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

      public ZoneBuilder name(String name)

      Name of the Zone.

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

      public ZoneBuilder description(@Nullable String description)

      Description of the Zone.

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

      public ZoneBuilder locations(Location... locations)

      List of locations that belong to the Zone.

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

      public ZoneBuilder locations(List<Location> locations)

      List of locations that belong to the Zone.

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

      public ZoneBuilder plusLocations(Location... locations)

      List of locations that belong to the Zone.

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

      public ZoneBuilder plusLocations(Function<LocationBuilder,LocationBuilder> builder)

      List of locations that belong to the Zone.

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

      public ZoneBuilder withLocations(Function<LocationBuilder,LocationBuilder> builder)

      List of locations that belong to the Zone.

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

      public ZoneBuilder addLocations(Function<LocationBuilder,Location> builder)

      List of locations that belong to the Zone.

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

      public ZoneBuilder setLocations(Function<LocationBuilder,Location> builder)

      List of locations that belong to the Zone.

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

      public String getId()

      Unique identifier of the Zone.

      Returns:
      id
    • getVersion

      public Long getVersion()

      Current version of the Zone.

      Returns:
      version
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

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

      Returns:
      createdAt
    • getLastModifiedAt

      public ZonedDateTime getLastModifiedAt()

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

      Returns:
      lastModifiedAt
    • getLastModifiedBy

      @Nullable public LastModifiedBy getLastModifiedBy()

      IDs and references that last modified the Zone.

      Returns:
      lastModifiedBy
    • getCreatedBy

      @Nullable public CreatedBy getCreatedBy()

      IDs and references that created the Zone.

      Returns:
      createdBy
    • getKey

      @Nullable public String getKey()

      User-defined unique identifier of the Zone.

      Returns:
      key
    • getName

      public String getName()

      Name of the Zone.

      Returns:
      name
    • getDescription

      @Nullable public String getDescription()

      Description of the Zone.

      Returns:
      description
    • getLocations

      public List<Location> getLocations()

      List of locations that belong to the Zone.

      Returns:
      locations
    • build

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

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

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

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