Class AssetBuilder

java.lang.Object
com.commercetools.importapi.models.common.AssetBuilder
All Implemented Interfaces:
Builder<Asset>

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

     Asset asset = Asset.builder()
             .key("{key}")
             .plusSources(sourcesBuilder -> sourcesBuilder)
             .name(nameBuilder -> nameBuilder)
             .build()
 
  • Constructor Details

    • AssetBuilder

      public AssetBuilder()
  • Method Details

    • key

      public AssetBuilder key(String key)

      User-defined identifier for the asset. Asset keys are unique inside their container (a product variant or a category).

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

      public AssetBuilder sources(AssetSource... sources)
      set values to the sources
      Parameters:
      sources - value to be set
      Returns:
      Builder
    • sources

      public AssetBuilder sources(List<AssetSource> sources)
      set value to the sources
      Parameters:
      sources - value to be set
      Returns:
      Builder
    • plusSources

      public AssetBuilder plusSources(AssetSource... sources)
      add values to the sources
      Parameters:
      sources - value to be set
      Returns:
      Builder
    • plusSources

      add the value to the sources using the builder function
      Parameters:
      builder - function to build the sources value
      Returns:
      Builder
    • withSources

      set the value to the sources using the builder function
      Parameters:
      builder - function to build the sources value
      Returns:
      Builder
    • addSources

      public AssetBuilder addSources(Function<AssetSourceBuilder,AssetSource> builder)
      add the value to the sources using the builder function
      Parameters:
      builder - function to build the sources value
      Returns:
      Builder
    • setSources

      public AssetBuilder setSources(Function<AssetSourceBuilder,AssetSource> builder)
      set the value to the sources using the builder function
      Parameters:
      builder - function to build the sources value
      Returns:
      Builder
    • name

      A localized string is a JSON object where the keys are of IETF language tag, and the values the corresponding strings used for that language.

      {
          "de": "Hundefutter",
          "en": "dog food"
        }
        
      Parameters:
      builder - function to build the name value
      Returns:
      Builder
    • withName

      A localized string is a JSON object where the keys are of IETF language tag, and the values the corresponding strings used for that language.

      {
          "de": "Hundefutter",
          "en": "dog food"
        }
        
      Parameters:
      builder - function to build the name value
      Returns:
      Builder
    • name

      public AssetBuilder name(LocalizedString name)

      A localized string is a JSON object where the keys are of IETF language tag, and the values the corresponding strings used for that language.

      {
          "de": "Hundefutter",
          "en": "dog food"
        }
        
      Parameters:
      name - value to be set
      Returns:
      Builder
    • description

      A localized string is a JSON object where the keys are of IETF language tag, and the values the corresponding strings used for that language.

      {
          "de": "Hundefutter",
          "en": "dog food"
        }
        
      Parameters:
      builder - function to build the description value
      Returns:
      Builder
    • withDescription

      public AssetBuilder withDescription(Function<LocalizedStringBuilder,LocalizedString> builder)

      A localized string is a JSON object where the keys are of IETF language tag, and the values the corresponding strings used for that language.

      {
          "de": "Hundefutter",
          "en": "dog food"
        }
        
      Parameters:
      builder - function to build the description value
      Returns:
      Builder
    • description

      public AssetBuilder description(@Nullable LocalizedString description)

      A localized string is a JSON object where the keys are of IETF language tag, and the values the corresponding strings used for that language.

      {
          "de": "Hundefutter",
          "en": "dog food"
        }
        
      Parameters:
      description - value to be set
      Returns:
      Builder
    • tags

      public AssetBuilder tags(@Nullable String... tags)
      set values to the tags
      Parameters:
      tags - value to be set
      Returns:
      Builder
    • tags

      public AssetBuilder tags(@Nullable List<String> tags)
      set value to the tags
      Parameters:
      tags - value to be set
      Returns:
      Builder
    • plusTags

      public AssetBuilder plusTags(@Nullable String... tags)
      add values to the tags
      Parameters:
      tags - value to be set
      Returns:
      Builder
    • custom

      The representation to be sent to the server when creating a resource with custom fields.

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

      public AssetBuilder withCustom(Function<CustomBuilder,Custom> builder)

      The representation to be sent to the server when creating a resource with custom fields.

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

      public AssetBuilder custom(@Nullable Custom custom)

      The representation to be sent to the server when creating a resource with custom fields.

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

      public String getKey()

      User-defined identifier for the asset. Asset keys are unique inside their container (a product variant or a category).

      Returns:
      key
    • getSources

      public List<AssetSource> getSources()
      value of sources}
      Returns:
      sources
    • getName

      public LocalizedString getName()

      A localized string is a JSON object where the keys are of IETF language tag, and the values the corresponding strings used for that language.

      {
          "de": "Hundefutter",
          "en": "dog food"
        }
        
      Returns:
      name
    • getDescription

      @Nullable public LocalizedString getDescription()

      A localized string is a JSON object where the keys are of IETF language tag, and the values the corresponding strings used for that language.

      {
          "de": "Hundefutter",
          "en": "dog food"
        }
        
      Returns:
      description
    • getTags

      @Nullable public List<String> getTags()
      value of tags}
      Returns:
      tags
    • getCustom

      @Nullable public Custom getCustom()

      The representation to be sent to the server when creating a resource with custom fields.

      Returns:
      custom
    • build

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

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

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

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