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 * CustomFields 019 * 020 * <hr> 021 * Example to create an instance using the builder pattern 022 * <div class=code-example> 023 * <pre><code class='java'> 024 * CustomFields customFields = CustomFields.builder() 025 * .type(typeBuilder -> typeBuilder) 026 * .fields(fieldsBuilder -> fieldsBuilder) 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 = CustomFieldsImpl.class) 033public interface CustomFields { 034 035 /** 036 * 037 * @return type 038 */ 039 @NotNull 040 @Valid 041 @JsonProperty("type") 042 public Reference getType(); 043 044 /** 045 * <p>A valid JSON object, based on FieldDefinition.</p> 046 * @return fields 047 */ 048 @NotNull 049 @Valid 050 @JsonProperty("fields") 051 public Object getFields(); 052 053 /** 054 * set type 055 * @param type value to be set 056 */ 057 058 public void setType(final Reference type); 059 060 /** 061 * <p>A valid JSON object, based on FieldDefinition.</p> 062 * @param fields value to be set 063 */ 064 065 public void setFields(final Object fields); 066 067 /** 068 * factory method 069 * @return instance of CustomFields 070 */ 071 public static CustomFields of() { 072 return new CustomFieldsImpl(); 073 } 074 075 /** 076 * factory method to create a shallow copy CustomFields 077 * @param template instance to be copied 078 * @return copy instance 079 */ 080 public static CustomFields of(final CustomFields template) { 081 CustomFieldsImpl instance = new CustomFieldsImpl(); 082 instance.setType(template.getType()); 083 instance.setFields(template.getFields()); 084 return instance; 085 } 086 087 /** 088 * factory method to create a deep copy of CustomFields 089 * @param template instance to be copied 090 * @return copy instance 091 */ 092 @Nullable 093 public static CustomFields deepCopy(@Nullable final CustomFields template) { 094 if (template == null) { 095 return null; 096 } 097 CustomFieldsImpl instance = new CustomFieldsImpl(); 098 instance.setType(com.commercetools.history.models.common.Reference.deepCopy(template.getType())); 099 instance.setFields(template.getFields()); 100 return instance; 101 } 102 103 /** 104 * builder factory method for CustomFields 105 * @return builder 106 */ 107 public static CustomFieldsBuilder builder() { 108 return CustomFieldsBuilder.of(); 109 } 110 111 /** 112 * create builder for CustomFields instance 113 * @param template instance with prefilled values for the builder 114 * @return builder 115 */ 116 public static CustomFieldsBuilder builder(final CustomFields template) { 117 return CustomFieldsBuilder.of(template); 118 } 119 120 /** 121 * accessor map function 122 * @param <T> mapped type 123 * @param helper function to map the object 124 * @return mapped value 125 */ 126 default <T> T withCustomFields(Function<CustomFields, T> helper) { 127 return helper.apply(this); 128 } 129 130 /** 131 * gives a TypeReference for usage with Jackson DataBind 132 * @return TypeReference 133 */ 134 public static com.fasterxml.jackson.core.type.TypeReference<CustomFields> typeReference() { 135 return new com.fasterxml.jackson.core.type.TypeReference<CustomFields>() { 136 @Override 137 public String toString() { 138 return "TypeReference<CustomFields>"; 139 } 140 }; 141 } 142}