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 * ItemState 019 * 020 * <hr> 021 * Example to create an instance using the builder pattern 022 * <div class=code-example> 023 * <pre><code class='java'> 024 * ItemState itemState = ItemState.builder() 025 * .quantity(1) 026 * .state(stateBuilder -> stateBuilder) 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 = ItemStateImpl.class) 033public interface ItemState { 034 035 /** 036 * 037 * @return quantity 038 */ 039 @NotNull 040 @JsonProperty("quantity") 041 public Integer getQuantity(); 042 043 /** 044 * 045 * @return state 046 */ 047 @NotNull 048 @Valid 049 @JsonProperty("state") 050 public Reference getState(); 051 052 /** 053 * set quantity 054 * @param quantity value to be set 055 */ 056 057 public void setQuantity(final Integer quantity); 058 059 /** 060 * set state 061 * @param state value to be set 062 */ 063 064 public void setState(final Reference state); 065 066 /** 067 * factory method 068 * @return instance of ItemState 069 */ 070 public static ItemState of() { 071 return new ItemStateImpl(); 072 } 073 074 /** 075 * factory method to create a shallow copy ItemState 076 * @param template instance to be copied 077 * @return copy instance 078 */ 079 public static ItemState of(final ItemState template) { 080 ItemStateImpl instance = new ItemStateImpl(); 081 instance.setQuantity(template.getQuantity()); 082 instance.setState(template.getState()); 083 return instance; 084 } 085 086 /** 087 * factory method to create a deep copy of ItemState 088 * @param template instance to be copied 089 * @return copy instance 090 */ 091 @Nullable 092 public static ItemState deepCopy(@Nullable final ItemState template) { 093 if (template == null) { 094 return null; 095 } 096 ItemStateImpl instance = new ItemStateImpl(); 097 instance.setQuantity(template.getQuantity()); 098 instance.setState(com.commercetools.history.models.common.Reference.deepCopy(template.getState())); 099 return instance; 100 } 101 102 /** 103 * builder factory method for ItemState 104 * @return builder 105 */ 106 public static ItemStateBuilder builder() { 107 return ItemStateBuilder.of(); 108 } 109 110 /** 111 * create builder for ItemState instance 112 * @param template instance with prefilled values for the builder 113 * @return builder 114 */ 115 public static ItemStateBuilder builder(final ItemState template) { 116 return ItemStateBuilder.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 withItemState(Function<ItemState, 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<ItemState> typeReference() { 134 return new com.fasterxml.jackson.core.type.TypeReference<ItemState>() { 135 @Override 136 public String toString() { 137 return "TypeReference<ItemState>"; 138 } 139 }; 140 } 141}