001 002package com.commercetools.api.models.product; 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.category.CategoryResourceIdentifier; 013import com.fasterxml.jackson.annotation.*; 014import com.fasterxml.jackson.databind.annotation.*; 015 016import io.vrap.rmf.base.client.utils.Generated; 017 018/** 019 * <p>Produces the ProductAddedToCategory Message.</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 * ProductAddToCategoryAction productAddToCategoryAction = ProductAddToCategoryAction.builder() 026 * .category(categoryBuilder -> categoryBuilder) 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 = ProductAddToCategoryActionImpl.class) 033public interface ProductAddToCategoryAction extends ProductUpdateAction { 034 035 /** 036 * discriminator value for ProductAddToCategoryAction 037 */ 038 String ADD_TO_CATEGORY = "addToCategory"; 039 040 /** 041 * <p>The Category to add.</p> 042 * @return category 043 */ 044 @NotNull 045 @Valid 046 @JsonProperty("category") 047 public CategoryResourceIdentifier getCategory(); 048 049 /** 050 * <p>A string representing a number between 0 and 1. Must start with <code>0.</code> and cannot end with <code>0</code>. If empty, any existing value will be removed.</p> 051 * @return orderHint 052 */ 053 054 @JsonProperty("orderHint") 055 public String getOrderHint(); 056 057 /** 058 * <p>If <code>true</code>, only the staged <code>categories</code> and <code>categoryOrderHints</code> are updated. If <code>false</code>, both the current and staged <code>categories</code> and <code>categoryOrderHints</code> are updated.</p> 059 * @return staged 060 */ 061 062 @JsonProperty("staged") 063 public Boolean getStaged(); 064 065 /** 066 * <p>The Category to add.</p> 067 * @param category value to be set 068 */ 069 070 public void setCategory(final CategoryResourceIdentifier category); 071 072 /** 073 * <p>A string representing a number between 0 and 1. Must start with <code>0.</code> and cannot end with <code>0</code>. If empty, any existing value will be removed.</p> 074 * @param orderHint value to be set 075 */ 076 077 public void setOrderHint(final String orderHint); 078 079 /** 080 * <p>If <code>true</code>, only the staged <code>categories</code> and <code>categoryOrderHints</code> are updated. If <code>false</code>, both the current and staged <code>categories</code> and <code>categoryOrderHints</code> are updated.</p> 081 * @param staged value to be set 082 */ 083 084 public void setStaged(final Boolean staged); 085 086 /** 087 * factory method 088 * @return instance of ProductAddToCategoryAction 089 */ 090 public static ProductAddToCategoryAction of() { 091 return new ProductAddToCategoryActionImpl(); 092 } 093 094 /** 095 * factory method to create a shallow copy ProductAddToCategoryAction 096 * @param template instance to be copied 097 * @return copy instance 098 */ 099 public static ProductAddToCategoryAction of(final ProductAddToCategoryAction template) { 100 ProductAddToCategoryActionImpl instance = new ProductAddToCategoryActionImpl(); 101 instance.setCategory(template.getCategory()); 102 instance.setOrderHint(template.getOrderHint()); 103 instance.setStaged(template.getStaged()); 104 return instance; 105 } 106 107 /** 108 * factory method to create a deep copy of ProductAddToCategoryAction 109 * @param template instance to be copied 110 * @return copy instance 111 */ 112 @Nullable 113 public static ProductAddToCategoryAction deepCopy(@Nullable final ProductAddToCategoryAction template) { 114 if (template == null) { 115 return null; 116 } 117 ProductAddToCategoryActionImpl instance = new ProductAddToCategoryActionImpl(); 118 instance.setCategory( 119 com.commercetools.api.models.category.CategoryResourceIdentifier.deepCopy(template.getCategory())); 120 instance.setOrderHint(template.getOrderHint()); 121 instance.setStaged(template.getStaged()); 122 return instance; 123 } 124 125 /** 126 * builder factory method for ProductAddToCategoryAction 127 * @return builder 128 */ 129 public static ProductAddToCategoryActionBuilder builder() { 130 return ProductAddToCategoryActionBuilder.of(); 131 } 132 133 /** 134 * create builder for ProductAddToCategoryAction instance 135 * @param template instance with prefilled values for the builder 136 * @return builder 137 */ 138 public static ProductAddToCategoryActionBuilder builder(final ProductAddToCategoryAction template) { 139 return ProductAddToCategoryActionBuilder.of(template); 140 } 141 142 /** 143 * accessor map function 144 * @param <T> mapped type 145 * @param helper function to map the object 146 * @return mapped value 147 */ 148 default <T> T withProductAddToCategoryAction(Function<ProductAddToCategoryAction, T> helper) { 149 return helper.apply(this); 150 } 151 152 /** 153 * gives a TypeReference for usage with Jackson DataBind 154 * @return TypeReference 155 */ 156 public static com.fasterxml.jackson.core.type.TypeReference<ProductAddToCategoryAction> typeReference() { 157 return new com.fasterxml.jackson.core.type.TypeReference<ProductAddToCategoryAction>() { 158 @Override 159 public String toString() { 160 return "TypeReference<ProductAddToCategoryAction>"; 161 } 162 }; 163 } 164}