001 002package com.commercetools.importapi.models.orders; 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.importapi.models.common.StateKeyReference; 013import com.fasterxml.jackson.annotation.*; 014import com.fasterxml.jackson.databind.annotation.*; 015 016import io.vrap.rmf.base.client.utils.Generated; 017 018/** 019 * <p>The item's 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 * ItemState itemState = ItemState.builder() 026 * .quantity(0.3) 027 * .state(stateBuilder -> stateBuilder) 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 = ItemStateImpl.class) 034public interface ItemState { 035 036 /** 037 * 038 * @return quantity 039 */ 040 @NotNull 041 @JsonProperty("quantity") 042 public Double getQuantity(); 043 044 /** 045 * <p>Maps to <code>ItemState.state</code>.</p> 046 * @return state 047 */ 048 @NotNull 049 @Valid 050 @JsonProperty("state") 051 public StateKeyReference getState(); 052 053 /** 054 * set quantity 055 * @param quantity value to be set 056 */ 057 058 public void setQuantity(final Double quantity); 059 060 /** 061 * <p>Maps to <code>ItemState.state</code>.</p> 062 * @param state value to be set 063 */ 064 065 public void setState(final StateKeyReference state); 066 067 /** 068 * factory method 069 * @return instance of ItemState 070 */ 071 public static ItemState of() { 072 return new ItemStateImpl(); 073 } 074 075 /** 076 * factory method to create a shallow copy ItemState 077 * @param template instance to be copied 078 * @return copy instance 079 */ 080 public static ItemState of(final ItemState template) { 081 ItemStateImpl instance = new ItemStateImpl(); 082 instance.setQuantity(template.getQuantity()); 083 instance.setState(template.getState()); 084 return instance; 085 } 086 087 /** 088 * factory method to create a deep copy of ItemState 089 * @param template instance to be copied 090 * @return copy instance 091 */ 092 @Nullable 093 public static ItemState deepCopy(@Nullable final ItemState template) { 094 if (template == null) { 095 return null; 096 } 097 ItemStateImpl instance = new ItemStateImpl(); 098 instance.setQuantity(template.getQuantity()); 099 instance.setState(com.commercetools.importapi.models.common.StateKeyReference.deepCopy(template.getState())); 100 return instance; 101 } 102 103 /** 104 * builder factory method for ItemState 105 * @return builder 106 */ 107 public static ItemStateBuilder builder() { 108 return ItemStateBuilder.of(); 109 } 110 111 /** 112 * create builder for ItemState instance 113 * @param template instance with prefilled values for the builder 114 * @return builder 115 */ 116 public static ItemStateBuilder builder(final ItemState template) { 117 return ItemStateBuilder.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 withItemState(Function<ItemState, 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<ItemState> typeReference() { 135 return new com.fasterxml.jackson.core.type.TypeReference<ItemState>() { 136 @Override 137 public String toString() { 138 return "TypeReference<ItemState>"; 139 } 140 }; 141 } 142}