001 002package com.commercetools.history.models.change_value; 003 004import java.util.*; 005import java.util.function.Function; 006 007import io.vrap.rmf.base.client.Builder; 008import io.vrap.rmf.base.client.utils.Generated; 009 010/** 011 * AssetChangeValueBuilder 012 * <hr> 013 * Example to create an instance using the builder pattern 014 * <div class=code-example> 015 * <pre><code class='java'> 016 * AssetChangeValue assetChangeValue = AssetChangeValue.builder() 017 * .id("{id}") 018 * .name(nameBuilder -> nameBuilder) 019 * .build() 020 * </code></pre> 021 * </div> 022 */ 023@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 024public class AssetChangeValueBuilder implements Builder<AssetChangeValue> { 025 026 private String id; 027 028 private com.commercetools.history.models.common.LocalizedString name; 029 030 /** 031 * <p><code>id</code> of the Asset.</p> 032 * @param id value to be set 033 * @return Builder 034 */ 035 036 public AssetChangeValueBuilder id(final String id) { 037 this.id = id; 038 return this; 039 } 040 041 /** 042 * <p>Name of the Asset.</p> 043 * @param builder function to build the name value 044 * @return Builder 045 */ 046 047 public AssetChangeValueBuilder name( 048 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedStringBuilder> builder) { 049 this.name = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()).build(); 050 return this; 051 } 052 053 /** 054 * <p>Name of the Asset.</p> 055 * @param builder function to build the name value 056 * @return Builder 057 */ 058 059 public AssetChangeValueBuilder withName( 060 Function<com.commercetools.history.models.common.LocalizedStringBuilder, com.commercetools.history.models.common.LocalizedString> builder) { 061 this.name = builder.apply(com.commercetools.history.models.common.LocalizedStringBuilder.of()); 062 return this; 063 } 064 065 /** 066 * <p>Name of the Asset.</p> 067 * @param name value to be set 068 * @return Builder 069 */ 070 071 public AssetChangeValueBuilder name(final com.commercetools.history.models.common.LocalizedString name) { 072 this.name = name; 073 return this; 074 } 075 076 /** 077 * <p><code>id</code> of the Asset.</p> 078 * @return id 079 */ 080 081 public String getId() { 082 return this.id; 083 } 084 085 /** 086 * <p>Name of the Asset.</p> 087 * @return name 088 */ 089 090 public com.commercetools.history.models.common.LocalizedString getName() { 091 return this.name; 092 } 093 094 /** 095 * builds AssetChangeValue with checking for non-null required values 096 * @return AssetChangeValue 097 */ 098 public AssetChangeValue build() { 099 Objects.requireNonNull(id, AssetChangeValue.class + ": id is missing"); 100 Objects.requireNonNull(name, AssetChangeValue.class + ": name is missing"); 101 return new AssetChangeValueImpl(id, name); 102 } 103 104 /** 105 * builds AssetChangeValue without checking for non-null required values 106 * @return AssetChangeValue 107 */ 108 public AssetChangeValue buildUnchecked() { 109 return new AssetChangeValueImpl(id, name); 110 } 111 112 /** 113 * factory method for an instance of AssetChangeValueBuilder 114 * @return builder 115 */ 116 public static AssetChangeValueBuilder of() { 117 return new AssetChangeValueBuilder(); 118 } 119 120 /** 121 * create builder for AssetChangeValue instance 122 * @param template instance with prefilled values for the builder 123 * @return builder 124 */ 125 public static AssetChangeValueBuilder of(final AssetChangeValue template) { 126 AssetChangeValueBuilder builder = new AssetChangeValueBuilder(); 127 builder.id = template.getId(); 128 builder.name = template.getName(); 129 return builder; 130 } 131 132}