001 002package com.commercetools.history.models.common; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007 008import javax.annotation.Nullable; 009import javax.validation.Valid; 010import javax.validation.constraints.NotNull; 011 012import com.fasterxml.jackson.annotation.*; 013import com.fasterxml.jackson.databind.annotation.*; 014 015import io.vrap.rmf.base.client.utils.Generated; 016 017/** 018 * Asset 019 * 020 * <hr> 021 * Example to create an instance using the builder pattern 022 * <div class=code-example> 023 * <pre><code class='java'> 024 * Asset asset = Asset.builder() 025 * .id("{id}") 026 * .name(nameBuilder -> nameBuilder) 027 * .description(descriptionBuilder -> descriptionBuilder) 028 * .custom(customBuilder -> customBuilder) 029 * .key("{key}") 030 * .build() 031 * </code></pre> 032 * </div> 033 */ 034@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 035@JsonDeserialize(as = AssetImpl.class) 036public interface Asset { 037 038 /** 039 * 040 * @return id 041 */ 042 @NotNull 043 @JsonProperty("id") 044 public String getId(); 045 046 /** 047 * 048 * @return name 049 */ 050 @NotNull 051 @Valid 052 @JsonProperty("name") 053 public LocalizedString getName(); 054 055 /** 056 * 057 * @return description 058 */ 059 @NotNull 060 @Valid 061 @JsonProperty("description") 062 public LocalizedString getDescription(); 063 064 /** 065 * 066 * @return custom 067 */ 068 @NotNull 069 @Valid 070 @JsonProperty("custom") 071 public CustomFields getCustom(); 072 073 /** 074 * 075 * @return key 076 */ 077 @NotNull 078 @JsonProperty("key") 079 public String getKey(); 080 081 /** 082 * set id 083 * @param id value to be set 084 */ 085 086 public void setId(final String id); 087 088 /** 089 * set name 090 * @param name value to be set 091 */ 092 093 public void setName(final LocalizedString name); 094 095 /** 096 * set description 097 * @param description value to be set 098 */ 099 100 public void setDescription(final LocalizedString description); 101 102 /** 103 * set custom 104 * @param custom value to be set 105 */ 106 107 public void setCustom(final CustomFields custom); 108 109 /** 110 * set key 111 * @param key value to be set 112 */ 113 114 public void setKey(final String key); 115 116 /** 117 * factory method 118 * @return instance of Asset 119 */ 120 public static Asset of() { 121 return new AssetImpl(); 122 } 123 124 /** 125 * factory method to create a shallow copy Asset 126 * @param template instance to be copied 127 * @return copy instance 128 */ 129 public static Asset of(final Asset template) { 130 AssetImpl instance = new AssetImpl(); 131 instance.setId(template.getId()); 132 instance.setName(template.getName()); 133 instance.setDescription(template.getDescription()); 134 instance.setCustom(template.getCustom()); 135 instance.setKey(template.getKey()); 136 return instance; 137 } 138 139 /** 140 * factory method to create a deep copy of Asset 141 * @param template instance to be copied 142 * @return copy instance 143 */ 144 @Nullable 145 public static Asset deepCopy(@Nullable final Asset template) { 146 if (template == null) { 147 return null; 148 } 149 AssetImpl instance = new AssetImpl(); 150 instance.setId(template.getId()); 151 instance.setName(com.commercetools.history.models.common.LocalizedString.deepCopy(template.getName())); 152 instance.setDescription( 153 com.commercetools.history.models.common.LocalizedString.deepCopy(template.getDescription())); 154 instance.setCustom(com.commercetools.history.models.common.CustomFields.deepCopy(template.getCustom())); 155 instance.setKey(template.getKey()); 156 return instance; 157 } 158 159 /** 160 * builder factory method for Asset 161 * @return builder 162 */ 163 public static AssetBuilder builder() { 164 return AssetBuilder.of(); 165 } 166 167 /** 168 * create builder for Asset instance 169 * @param template instance with prefilled values for the builder 170 * @return builder 171 */ 172 public static AssetBuilder builder(final Asset template) { 173 return AssetBuilder.of(template); 174 } 175 176 /** 177 * accessor map function 178 * @param <T> mapped type 179 * @param helper function to map the object 180 * @return mapped value 181 */ 182 default <T> T withAsset(Function<Asset, T> helper) { 183 return helper.apply(this); 184 } 185 186 /** 187 * gives a TypeReference for usage with Jackson DataBind 188 * @return TypeReference 189 */ 190 public static com.fasterxml.jackson.core.type.TypeReference<Asset> typeReference() { 191 return new com.fasterxml.jackson.core.type.TypeReference<Asset>() { 192 @Override 193 public String toString() { 194 return "TypeReference<Asset>"; 195 } 196 }; 197 } 198}