001 002package com.commercetools.api.models.state; 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.api.models.common.Reference; 013import com.fasterxml.jackson.annotation.*; 014import com.fasterxml.jackson.databind.annotation.*; 015 016import io.vrap.rmf.base.client.utils.Generated; 017 018/** 019 * <p>Reference to a State.</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 * StateReference stateReference = StateReference.builder() 026 * .id("{id}") 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 = StateReferenceImpl.class) 033public interface StateReference extends Reference, com.commercetools.api.models.Identifiable<State> { 034 035 /** 036 * discriminator value for StateReference 037 */ 038 String STATE = "state"; 039 040 /** 041 * <p>Contains the representation of the expanded State. Only present in responses to requests with Reference Expansion for States.</p> 042 * @return obj 043 */ 044 @Valid 045 @JsonProperty("obj") 046 public State getObj(); 047 048 /** 049 * <p>Unique identifier of the referenced State.</p> 050 * @return id 051 */ 052 @NotNull 053 @JsonProperty("id") 054 public String getId(); 055 056 /** 057 * <p>Contains the representation of the expanded State. Only present in responses to requests with Reference Expansion for States.</p> 058 * @param obj value to be set 059 */ 060 061 public void setObj(final State obj); 062 063 /** 064 * <p>Unique identifier of the referenced State.</p> 065 * @param id value to be set 066 */ 067 068 public void setId(final String id); 069 070 /** 071 * factory method 072 * @return instance of StateReference 073 */ 074 public static StateReference of() { 075 return new StateReferenceImpl(); 076 } 077 078 /** 079 * factory method to create a shallow copy StateReference 080 * @param template instance to be copied 081 * @return copy instance 082 */ 083 public static StateReference of(final StateReference template) { 084 StateReferenceImpl instance = new StateReferenceImpl(); 085 instance.setId(template.getId()); 086 instance.setObj(template.getObj()); 087 return instance; 088 } 089 090 /** 091 * factory method to create a deep copy of StateReference 092 * @param template instance to be copied 093 * @return copy instance 094 */ 095 @Nullable 096 public static StateReference deepCopy(@Nullable final StateReference template) { 097 if (template == null) { 098 return null; 099 } 100 StateReferenceImpl instance = new StateReferenceImpl(); 101 instance.setId(template.getId()); 102 instance.setObj(com.commercetools.api.models.state.State.deepCopy(template.getObj())); 103 return instance; 104 } 105 106 /** 107 * builder factory method for StateReference 108 * @return builder 109 */ 110 public static StateReferenceBuilder builder() { 111 return StateReferenceBuilder.of(); 112 } 113 114 /** 115 * create builder for StateReference instance 116 * @param template instance with prefilled values for the builder 117 * @return builder 118 */ 119 public static StateReferenceBuilder builder(final StateReference template) { 120 return StateReferenceBuilder.of(template); 121 } 122 123 /** 124 * accessor map function 125 * @param <T> mapped type 126 * @param helper function to map the object 127 * @return mapped value 128 */ 129 default <T> T withStateReference(Function<StateReference, T> helper) { 130 return helper.apply(this); 131 } 132 133 /** 134 * gives a TypeReference for usage with Jackson DataBind 135 * @return TypeReference 136 */ 137 public static com.fasterxml.jackson.core.type.TypeReference<StateReference> typeReference() { 138 return new com.fasterxml.jackson.core.type.TypeReference<StateReference>() { 139 @Override 140 public String toString() { 141 return "TypeReference<StateReference>"; 142 } 143 }; 144 } 145}