001 002package com.commercetools.api.models.type; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007import java.util.stream.Collectors; 008 009import javax.annotation.Nullable; 010import javax.validation.Valid; 011import javax.validation.constraints.NotNull; 012 013import com.fasterxml.jackson.annotation.*; 014import com.fasterxml.jackson.databind.annotation.*; 015 016import io.vrap.rmf.base.client.utils.Generated; 017 018/** 019 * <p>Field type for localized enum values.</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 * CustomFieldLocalizedEnumType customFieldLocalizedEnumType = CustomFieldLocalizedEnumType.builder() 026 * .plusValues(valuesBuilder -> valuesBuilder) 027 * .build() 028 * </code></pre> 029 * </div> 030 */ 031@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 032@JsonDeserialize(as = CustomFieldLocalizedEnumTypeImpl.class) 033public interface CustomFieldLocalizedEnumType extends FieldType { 034 035 /** 036 * discriminator value for CustomFieldLocalizedEnumType 037 */ 038 String LOCALIZED_ENUM = "LocalizedEnum"; 039 040 /** 041 * <p>Allowed values.</p> 042 * @return values 043 */ 044 @NotNull 045 @Valid 046 @JsonProperty("values") 047 public List<CustomFieldLocalizedEnumValue> getValues(); 048 049 /** 050 * <p>Allowed values.</p> 051 * @param values values to be set 052 */ 053 054 @JsonIgnore 055 public void setValues(final CustomFieldLocalizedEnumValue... values); 056 057 /** 058 * <p>Allowed values.</p> 059 * @param values values to be set 060 */ 061 062 public void setValues(final List<CustomFieldLocalizedEnumValue> values); 063 064 /** 065 * factory method 066 * @return instance of CustomFieldLocalizedEnumType 067 */ 068 public static CustomFieldLocalizedEnumType of() { 069 return new CustomFieldLocalizedEnumTypeImpl(); 070 } 071 072 /** 073 * factory method to create a shallow copy CustomFieldLocalizedEnumType 074 * @param template instance to be copied 075 * @return copy instance 076 */ 077 public static CustomFieldLocalizedEnumType of(final CustomFieldLocalizedEnumType template) { 078 CustomFieldLocalizedEnumTypeImpl instance = new CustomFieldLocalizedEnumTypeImpl(); 079 instance.setValues(template.getValues()); 080 return instance; 081 } 082 083 /** 084 * factory method to create a deep copy of CustomFieldLocalizedEnumType 085 * @param template instance to be copied 086 * @return copy instance 087 */ 088 @Nullable 089 public static CustomFieldLocalizedEnumType deepCopy(@Nullable final CustomFieldLocalizedEnumType template) { 090 if (template == null) { 091 return null; 092 } 093 CustomFieldLocalizedEnumTypeImpl instance = new CustomFieldLocalizedEnumTypeImpl(); 094 instance.setValues(Optional.ofNullable(template.getValues()) 095 .map(t -> t.stream() 096 .map(com.commercetools.api.models.type.CustomFieldLocalizedEnumValue::deepCopy) 097 .collect(Collectors.toList())) 098 .orElse(null)); 099 return instance; 100 } 101 102 /** 103 * builder factory method for CustomFieldLocalizedEnumType 104 * @return builder 105 */ 106 public static CustomFieldLocalizedEnumTypeBuilder builder() { 107 return CustomFieldLocalizedEnumTypeBuilder.of(); 108 } 109 110 /** 111 * create builder for CustomFieldLocalizedEnumType instance 112 * @param template instance with prefilled values for the builder 113 * @return builder 114 */ 115 public static CustomFieldLocalizedEnumTypeBuilder builder(final CustomFieldLocalizedEnumType template) { 116 return CustomFieldLocalizedEnumTypeBuilder.of(template); 117 } 118 119 /** 120 * accessor map function 121 * @param <T> mapped type 122 * @param helper function to map the object 123 * @return mapped value 124 */ 125 default <T> T withCustomFieldLocalizedEnumType(Function<CustomFieldLocalizedEnumType, T> helper) { 126 return helper.apply(this); 127 } 128 129 /** 130 * gives a TypeReference for usage with Jackson DataBind 131 * @return TypeReference 132 */ 133 public static com.fasterxml.jackson.core.type.TypeReference<CustomFieldLocalizedEnumType> typeReference() { 134 return new com.fasterxml.jackson.core.type.TypeReference<CustomFieldLocalizedEnumType>() { 135 @Override 136 public String toString() { 137 return "TypeReference<CustomFieldLocalizedEnumType>"; 138 } 139 }; 140 } 141}