Class ImageBuilder

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

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

     Image image = Image.builder()
             .url("{url}")
             .dimensions(dimensionsBuilder -> dimensionsBuilder)
             .build()
 
  • Constructor Details

    • ImageBuilder

      public ImageBuilder()
  • Method Details

    • url

      public ImageBuilder url(String url)

      URL of the image in its original size that must be unique within a single ProductVariant.

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

      Dimensions of the original image.

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

      public ImageBuilder withDimensions(Function<ImageDimensionsBuilder,ImageDimensions> builder)

      Dimensions of the original image.

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

      public ImageBuilder dimensions(ImageDimensions dimensions)

      Dimensions of the original image.

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

      public ImageBuilder label(@Nullable String label)

      Custom label for the image.

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

      public String getUrl()

      URL of the image in its original size that must be unique within a single ProductVariant.

      Returns:
      url
    • getDimensions

      public ImageDimensions getDimensions()

      Dimensions of the original image.

      Returns:
      dimensions
    • getLabel

      @Nullable public String getLabel()

      Custom label for the image.

      Returns:
      label
    • build

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

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

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

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