001 002package com.commercetools.api.models.customer_group; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007 008import javax.annotation.Nullable; 009import javax.validation.constraints.NotNull; 010 011import com.fasterxml.jackson.annotation.*; 012import com.fasterxml.jackson.databind.annotation.*; 013 014import io.vrap.rmf.base.client.utils.Generated; 015 016/** 017 * CustomerGroupUpdateAction 018 * 019 * <hr> 020 * Example to create a subtype instance using the builder pattern 021 * <div class=code-example> 022 * <pre><code class='java'> 023 * CustomerGroupUpdateAction customerGroupUpdateAction = CustomerGroupUpdateAction.changeNameBuilder() 024 * name("{name}") 025 * .build() 026 * </code></pre> 027 * </div> 028 */ 029@JsonSubTypes({ 030 @JsonSubTypes.Type(value = com.commercetools.api.models.customer_group.CustomerGroupChangeNameActionImpl.class, name = CustomerGroupChangeNameAction.CHANGE_NAME), 031 @JsonSubTypes.Type(value = com.commercetools.api.models.customer_group.CustomerGroupSetCustomFieldActionImpl.class, name = CustomerGroupSetCustomFieldAction.SET_CUSTOM_FIELD), 032 @JsonSubTypes.Type(value = com.commercetools.api.models.customer_group.CustomerGroupSetCustomTypeActionImpl.class, name = CustomerGroupSetCustomTypeAction.SET_CUSTOM_TYPE), 033 @JsonSubTypes.Type(value = com.commercetools.api.models.customer_group.CustomerGroupSetKeyActionImpl.class, name = CustomerGroupSetKeyAction.SET_KEY) }) 034@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "action", defaultImpl = CustomerGroupUpdateActionImpl.class, visible = true) 035@JsonDeserialize(as = CustomerGroupUpdateActionImpl.class) 036@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 037public interface CustomerGroupUpdateAction 038 extends com.commercetools.api.models.ResourceUpdateAction<CustomerGroupUpdateAction> { 039 040 /** 041 * 042 * @return action 043 */ 044 @NotNull 045 @JsonProperty("action") 046 public String getAction(); 047 048 /** 049 * factory method to create a deep copy of CustomerGroupUpdateAction 050 * @param template instance to be copied 051 * @return copy instance 052 */ 053 @Nullable 054 public static CustomerGroupUpdateAction deepCopy(@Nullable final CustomerGroupUpdateAction template) { 055 if (template == null) { 056 return null; 057 } 058 if (template instanceof com.commercetools.api.models.customer_group.CustomerGroupChangeNameAction) { 059 return com.commercetools.api.models.customer_group.CustomerGroupChangeNameAction 060 .deepCopy((com.commercetools.api.models.customer_group.CustomerGroupChangeNameAction) template); 061 } 062 if (template instanceof com.commercetools.api.models.customer_group.CustomerGroupSetCustomFieldAction) { 063 return com.commercetools.api.models.customer_group.CustomerGroupSetCustomFieldAction 064 .deepCopy((com.commercetools.api.models.customer_group.CustomerGroupSetCustomFieldAction) template); 065 } 066 if (template instanceof com.commercetools.api.models.customer_group.CustomerGroupSetCustomTypeAction) { 067 return com.commercetools.api.models.customer_group.CustomerGroupSetCustomTypeAction 068 .deepCopy((com.commercetools.api.models.customer_group.CustomerGroupSetCustomTypeAction) template); 069 } 070 if (template instanceof com.commercetools.api.models.customer_group.CustomerGroupSetKeyAction) { 071 return com.commercetools.api.models.customer_group.CustomerGroupSetKeyAction 072 .deepCopy((com.commercetools.api.models.customer_group.CustomerGroupSetKeyAction) template); 073 } 074 CustomerGroupUpdateActionImpl instance = new CustomerGroupUpdateActionImpl(); 075 return instance; 076 } 077 078 /** 079 * builder for changeName subtype 080 * @return builder 081 */ 082 public static com.commercetools.api.models.customer_group.CustomerGroupChangeNameActionBuilder changeNameBuilder() { 083 return com.commercetools.api.models.customer_group.CustomerGroupChangeNameActionBuilder.of(); 084 } 085 086 /** 087 * builder for setCustomField subtype 088 * @return builder 089 */ 090 public static com.commercetools.api.models.customer_group.CustomerGroupSetCustomFieldActionBuilder setCustomFieldBuilder() { 091 return com.commercetools.api.models.customer_group.CustomerGroupSetCustomFieldActionBuilder.of(); 092 } 093 094 /** 095 * builder for setCustomType subtype 096 * @return builder 097 */ 098 public static com.commercetools.api.models.customer_group.CustomerGroupSetCustomTypeActionBuilder setCustomTypeBuilder() { 099 return com.commercetools.api.models.customer_group.CustomerGroupSetCustomTypeActionBuilder.of(); 100 } 101 102 /** 103 * builder for setKey subtype 104 * @return builder 105 */ 106 public static com.commercetools.api.models.customer_group.CustomerGroupSetKeyActionBuilder setKeyBuilder() { 107 return com.commercetools.api.models.customer_group.CustomerGroupSetKeyActionBuilder.of(); 108 } 109 110 /** 111 * accessor map function 112 * @param <T> mapped type 113 * @param helper function to map the object 114 * @return mapped value 115 */ 116 default <T> T withCustomerGroupUpdateAction(Function<CustomerGroupUpdateAction, T> helper) { 117 return helper.apply(this); 118 } 119 120 /** 121 * gives a TypeReference for usage with Jackson DataBind 122 * @return TypeReference 123 */ 124 public static com.fasterxml.jackson.core.type.TypeReference<CustomerGroupUpdateAction> typeReference() { 125 return new com.fasterxml.jackson.core.type.TypeReference<CustomerGroupUpdateAction>() { 126 @Override 127 public String toString() { 128 return "TypeReference<CustomerGroupUpdateAction>"; 129 } 130 }; 131 } 132}