com.commercetools.history.models.change.SetPricesChange Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commercetools-sdk-java-history Show documentation
Show all versions of commercetools-sdk-java-history Show documentation
The e-commerce SDK from commercetools Composable Commerce for Java
package com.commercetools.history.models.change;
import java.time.*;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import com.commercetools.history.models.common.Price;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.*;
import io.vrap.rmf.base.client.utils.Generated;
/**
* Change triggered by the Set Prices update action.
*
*
* Example to create an instance using the builder pattern
*
*
* SetPricesChange setPricesChange = SetPricesChange.builder()
* .change("{change}")
* .plusPreviousValue(previousValueBuilder -> previousValueBuilder)
* .plusNextValue(nextValueBuilder -> nextValueBuilder)
* .catalogData("{catalogData}")
* .variant("{variant}")
* .build()
*
*
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
@JsonDeserialize(as = SetPricesChangeImpl.class)
public interface SetPricesChange extends Change {
/**
* discriminator value for SetPricesChange
*/
String SET_PRICES_CHANGE = "SetPricesChange";
/**
*
* @return type
*/
@NotNull
@JsonProperty("type")
public String getType();
/**
*
* @return change
*/
@NotNull
@JsonProperty("change")
public String getChange();
/**
* Value before the change.
* @return previousValue
*/
@NotNull
@Valid
@JsonProperty("previousValue")
public List getPreviousValue();
/**
* Value after the change.
* @return nextValue
*/
@NotNull
@Valid
@JsonProperty("nextValue")
public List getNextValue();
/**
*
* staged
, if the staged ProductCatalogData was updated.
* current
, if the current ProductCatalogData was updated.
*
* @return catalogData
*/
@NotNull
@JsonProperty("catalogData")
public String getCatalogData();
/**
* sku
or key
of the ProductVariant.
* @return variant
*/
@NotNull
@JsonProperty("variant")
public String getVariant();
/**
* set change
* @param change value to be set
*/
public void setChange(final String change);
/**
* Value before the change.
* @param previousValue values to be set
*/
@JsonIgnore
public void setPreviousValue(final Price... previousValue);
/**
* Value before the change.
* @param previousValue values to be set
*/
public void setPreviousValue(final List previousValue);
/**
* Value after the change.
* @param nextValue values to be set
*/
@JsonIgnore
public void setNextValue(final Price... nextValue);
/**
* Value after the change.
* @param nextValue values to be set
*/
public void setNextValue(final List nextValue);
/**
*
* staged
, if the staged ProductCatalogData was updated.
* current
, if the current ProductCatalogData was updated.
*
* @param catalogData value to be set
*/
public void setCatalogData(final String catalogData);
/**
* sku
or key
of the ProductVariant.
* @param variant value to be set
*/
public void setVariant(final String variant);
/**
* factory method
* @return instance of SetPricesChange
*/
public static SetPricesChange of() {
return new SetPricesChangeImpl();
}
/**
* factory method to create a shallow copy SetPricesChange
* @param template instance to be copied
* @return copy instance
*/
public static SetPricesChange of(final SetPricesChange template) {
SetPricesChangeImpl instance = new SetPricesChangeImpl();
instance.setChange(template.getChange());
instance.setPreviousValue(template.getPreviousValue());
instance.setNextValue(template.getNextValue());
instance.setCatalogData(template.getCatalogData());
instance.setVariant(template.getVariant());
return instance;
}
/**
* factory method to create a deep copy of SetPricesChange
* @param template instance to be copied
* @return copy instance
*/
@Nullable
public static SetPricesChange deepCopy(@Nullable final SetPricesChange template) {
if (template == null) {
return null;
}
SetPricesChangeImpl instance = new SetPricesChangeImpl();
instance.setChange(template.getChange());
instance.setPreviousValue(Optional.ofNullable(template.getPreviousValue())
.map(t -> t.stream()
.map(com.commercetools.history.models.common.Price::deepCopy)
.collect(Collectors.toList()))
.orElse(null));
instance.setNextValue(Optional.ofNullable(template.getNextValue())
.map(t -> t.stream()
.map(com.commercetools.history.models.common.Price::deepCopy)
.collect(Collectors.toList()))
.orElse(null));
instance.setCatalogData(template.getCatalogData());
instance.setVariant(template.getVariant());
return instance;
}
/**
* builder factory method for SetPricesChange
* @return builder
*/
public static SetPricesChangeBuilder builder() {
return SetPricesChangeBuilder.of();
}
/**
* create builder for SetPricesChange instance
* @param template instance with prefilled values for the builder
* @return builder
*/
public static SetPricesChangeBuilder builder(final SetPricesChange template) {
return SetPricesChangeBuilder.of(template);
}
/**
* accessor map function
* @param mapped type
* @param helper function to map the object
* @return mapped value
*/
default T withSetPricesChange(Function helper) {
return helper.apply(this);
}
/**
* gives a TypeReference for usage with Jackson DataBind
* @return TypeReference
*/
public static com.fasterxml.jackson.core.type.TypeReference typeReference() {
return new com.fasterxml.jackson.core.type.TypeReference() {
@Override
public String toString() {
return "TypeReference";
}
};
}
}