001 002package com.commercetools.history.models.change_value; 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.commercetools.history.models.common.LocalizedString; 013import com.fasterxml.jackson.annotation.*; 014import com.fasterxml.jackson.databind.annotation.*; 015 016import io.vrap.rmf.base.client.utils.Generated; 017 018/** 019 * <p>Only present if <code>expand</code> is set to <code>true</code>.</p> 020 * 021 * <hr> 022 * Example to create an instance using the builder pattern 023 * <div class=code-example> 024 * <pre><code class='java'> 025 * CustomFieldExpandedValue customFieldExpandedValue = CustomFieldExpandedValue.builder() 026 * .name("{name}") 027 * .label(labelBuilder -> labelBuilder) 028 * .build() 029 * </code></pre> 030 * </div> 031 */ 032@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 033@JsonDeserialize(as = CustomFieldExpandedValueImpl.class) 034public interface CustomFieldExpandedValue { 035 036 /** 037 * <p>Name of the Custom Field.</p> 038 * @return name 039 */ 040 @NotNull 041 @JsonProperty("name") 042 public String getName(); 043 044 /** 045 * <p>CustomFieldValue based on the FieldType.</p> 046 * @return value 047 */ 048 @NotNull 049 @JsonProperty("value") 050 public Object getValue(); 051 052 /** 053 * <p>User-defined label of the Custom Field.</p> 054 * @return label 055 */ 056 @NotNull 057 @Valid 058 @JsonProperty("label") 059 public LocalizedString getLabel(); 060 061 /** 062 * <p>Name of the Custom Field.</p> 063 * @param name value to be set 064 */ 065 066 public void setName(final String name); 067 068 /** 069 * <p>CustomFieldValue based on the FieldType.</p> 070 * @param value value to be set 071 */ 072 073 public void setValue(final Object value); 074 075 /** 076 * <p>User-defined label of the Custom Field.</p> 077 * @param label value to be set 078 */ 079 080 public void setLabel(final LocalizedString label); 081 082 /** 083 * factory method 084 * @return instance of CustomFieldExpandedValue 085 */ 086 public static CustomFieldExpandedValue of() { 087 return new CustomFieldExpandedValueImpl(); 088 } 089 090 /** 091 * factory method to create a shallow copy CustomFieldExpandedValue 092 * @param template instance to be copied 093 * @return copy instance 094 */ 095 public static CustomFieldExpandedValue of(final CustomFieldExpandedValue template) { 096 CustomFieldExpandedValueImpl instance = new CustomFieldExpandedValueImpl(); 097 instance.setName(template.getName()); 098 instance.setValue(template.getValue()); 099 instance.setLabel(template.getLabel()); 100 return instance; 101 } 102 103 /** 104 * factory method to create a deep copy of CustomFieldExpandedValue 105 * @param template instance to be copied 106 * @return copy instance 107 */ 108 @Nullable 109 public static CustomFieldExpandedValue deepCopy(@Nullable final CustomFieldExpandedValue template) { 110 if (template == null) { 111 return null; 112 } 113 CustomFieldExpandedValueImpl instance = new CustomFieldExpandedValueImpl(); 114 instance.setName(template.getName()); 115 instance.setValue(template.getValue()); 116 instance.setLabel(com.commercetools.history.models.common.LocalizedString.deepCopy(template.getLabel())); 117 return instance; 118 } 119 120 /** 121 * builder factory method for CustomFieldExpandedValue 122 * @return builder 123 */ 124 public static CustomFieldExpandedValueBuilder builder() { 125 return CustomFieldExpandedValueBuilder.of(); 126 } 127 128 /** 129 * create builder for CustomFieldExpandedValue instance 130 * @param template instance with prefilled values for the builder 131 * @return builder 132 */ 133 public static CustomFieldExpandedValueBuilder builder(final CustomFieldExpandedValue template) { 134 return CustomFieldExpandedValueBuilder.of(template); 135 } 136 137 /** 138 * accessor map function 139 * @param <T> mapped type 140 * @param helper function to map the object 141 * @return mapped value 142 */ 143 default <T> T withCustomFieldExpandedValue(Function<CustomFieldExpandedValue, T> helper) { 144 return helper.apply(this); 145 } 146 147 /** 148 * gives a TypeReference for usage with Jackson DataBind 149 * @return TypeReference 150 */ 151 public static com.fasterxml.jackson.core.type.TypeReference<CustomFieldExpandedValue> typeReference() { 152 return new com.fasterxml.jackson.core.type.TypeReference<CustomFieldExpandedValue>() { 153 @Override 154 public String toString() { 155 return "TypeReference<CustomFieldExpandedValue>"; 156 } 157 }; 158 } 159}