001
002package com.commercetools.api.models.payment;
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 * PaymentSetCustomFieldAction
018 *
019 * <hr>
020 * Example to create an instance using the builder pattern
021 * <div class=code-example>
022 * <pre><code class='java'>
023 *     PaymentSetCustomFieldAction paymentSetCustomFieldAction = PaymentSetCustomFieldAction.builder()
024 *             .name("{name}")
025 *             .build()
026 * </code></pre>
027 * </div>
028 */
029@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
030@JsonDeserialize(as = PaymentSetCustomFieldActionImpl.class)
031public interface PaymentSetCustomFieldAction extends PaymentUpdateAction {
032
033    /**
034     * discriminator value for PaymentSetCustomFieldAction
035     */
036    String SET_CUSTOM_FIELD = "setCustomField";
037
038    /**
039     *  <p>Name of the Custom Field.</p>
040     * @return name
041     */
042    @NotNull
043    @JsonProperty("name")
044    public String getName();
045
046    /**
047     *  <p>If <code>value</code> is absent or <code>null</code>, this field will be removed if it exists. Removing a field that does not exist returns an InvalidOperation error. If <code>value</code> is provided, it is set for the field defined by <code>name</code>.</p>
048     * @return value
049     */
050
051    @JsonProperty("value")
052    public Object getValue();
053
054    /**
055     *  <p>Name of the Custom Field.</p>
056     * @param name value to be set
057     */
058
059    public void setName(final String name);
060
061    /**
062     *  <p>If <code>value</code> is absent or <code>null</code>, this field will be removed if it exists. Removing a field that does not exist returns an InvalidOperation error. If <code>value</code> is provided, it is set for the field defined by <code>name</code>.</p>
063     * @param value value to be set
064     */
065
066    public void setValue(final Object value);
067
068    /**
069     * factory method
070     * @return instance of PaymentSetCustomFieldAction
071     */
072    public static PaymentSetCustomFieldAction of() {
073        return new PaymentSetCustomFieldActionImpl();
074    }
075
076    /**
077     * factory method to create a shallow copy PaymentSetCustomFieldAction
078     * @param template instance to be copied
079     * @return copy instance
080     */
081    public static PaymentSetCustomFieldAction of(final PaymentSetCustomFieldAction template) {
082        PaymentSetCustomFieldActionImpl instance = new PaymentSetCustomFieldActionImpl();
083        instance.setName(template.getName());
084        instance.setValue(template.getValue());
085        return instance;
086    }
087
088    /**
089     * factory method to create a deep copy of PaymentSetCustomFieldAction
090     * @param template instance to be copied
091     * @return copy instance
092     */
093    @Nullable
094    public static PaymentSetCustomFieldAction deepCopy(@Nullable final PaymentSetCustomFieldAction template) {
095        if (template == null) {
096            return null;
097        }
098        PaymentSetCustomFieldActionImpl instance = new PaymentSetCustomFieldActionImpl();
099        instance.setName(template.getName());
100        instance.setValue(template.getValue());
101        return instance;
102    }
103
104    /**
105     * builder factory method for PaymentSetCustomFieldAction
106     * @return builder
107     */
108    public static PaymentSetCustomFieldActionBuilder builder() {
109        return PaymentSetCustomFieldActionBuilder.of();
110    }
111
112    /**
113     * create builder for PaymentSetCustomFieldAction instance
114     * @param template instance with prefilled values for the builder
115     * @return builder
116     */
117    public static PaymentSetCustomFieldActionBuilder builder(final PaymentSetCustomFieldAction template) {
118        return PaymentSetCustomFieldActionBuilder.of(template);
119    }
120
121    /**
122     * accessor map function
123     * @param <T> mapped type
124     * @param helper function to map the object
125     * @return mapped value
126     */
127    default <T> T withPaymentSetCustomFieldAction(Function<PaymentSetCustomFieldAction, T> helper) {
128        return helper.apply(this);
129    }
130
131    public static PaymentSetCustomFieldAction ofUnset(final String name) {
132        return PaymentSetCustomFieldActionBuilder.of().name(name).build();
133    }
134
135    /**
136     * gives a TypeReference for usage with Jackson DataBind
137     * @return TypeReference
138     */
139    public static com.fasterxml.jackson.core.type.TypeReference<PaymentSetCustomFieldAction> typeReference() {
140        return new com.fasterxml.jackson.core.type.TypeReference<PaymentSetCustomFieldAction>() {
141            @Override
142            public String toString() {
143                return "TypeReference<PaymentSetCustomFieldAction>";
144            }
145        };
146    }
147}