Class ImageBuilder

java.lang.Object
com.commercetools.importapi.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. The URL must be unique within a single variant. It can be used to obtain the image in different sizes.

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

      Dimensions of the original image. This can be used by your application, for example, to determine whether the image is large enough to display a zoom view.

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

      public ImageBuilder withDimensions(Function<AssetDimensionsBuilder,AssetDimensions> builder)

      Dimensions of the original image. This can be used by your application, for example, to determine whether the image is large enough to display a zoom view.

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

      public ImageBuilder dimensions(AssetDimensions dimensions)

      Dimensions of the original image. This can be used by your application, for example, to determine whether the image is large enough to display a zoom view.

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

      public ImageBuilder label(@Nullable String label)

      Custom label that can be used, for example, as an image description.

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

      public String getUrl()

      URL of the image in its original size. The URL must be unique within a single variant. It can be used to obtain the image in different sizes.

      Returns:
      url
    • getDimensions

      public AssetDimensions getDimensions()

      Dimensions of the original image. This can be used by your application, for example, to determine whether the image is large enough to display a zoom view.

      Returns:
      dimensions
    • getLabel

      @Nullable public String getLabel()

      Custom label that can be used, for example, as an image description.

      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