com.commercetools.importapi.models.common.DiscountedPrice Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commercetools-sdk-java-importapi Show documentation
Show all versions of commercetools-sdk-java-importapi Show documentation
The e-commerce SDK from commercetools Composable Commerce for Java
package com.commercetools.importapi.models.common;
import java.time.*;
import java.util.*;
import java.util.function.Function;
import javax.annotation.Nullable;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.*;
import io.vrap.rmf.base.client.utils.Generated;
/**
* DiscountedPrice
*
*
* Example to create an instance using the builder pattern
*
*
* DiscountedPrice discountedPrice = DiscountedPrice.builder()
* .value(valueBuilder -> valueBuilder)
* .discount(discountBuilder -> discountBuilder)
* .build()
*
*
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
@JsonDeserialize(as = DiscountedPriceImpl.class)
public interface DiscountedPrice {
/**
*
* @return value
*/
@NotNull
@Valid
@JsonProperty("value")
public TypedMoney getValue();
/**
* Reference to a ProductDiscount.
* @return discount
*/
@NotNull
@Valid
@JsonProperty("discount")
public ProductDiscountKeyReference getDiscount();
/**
* set value
* @param value value to be set
*/
public void setValue(final TypedMoney value);
/**
* Reference to a ProductDiscount.
* @param discount value to be set
*/
public void setDiscount(final ProductDiscountKeyReference discount);
/**
* factory method
* @return instance of DiscountedPrice
*/
public static DiscountedPrice of() {
return new DiscountedPriceImpl();
}
/**
* factory method to create a shallow copy DiscountedPrice
* @param template instance to be copied
* @return copy instance
*/
public static DiscountedPrice of(final DiscountedPrice template) {
DiscountedPriceImpl instance = new DiscountedPriceImpl();
instance.setValue(template.getValue());
instance.setDiscount(template.getDiscount());
return instance;
}
/**
* factory method to create a deep copy of DiscountedPrice
* @param template instance to be copied
* @return copy instance
*/
@Nullable
public static DiscountedPrice deepCopy(@Nullable final DiscountedPrice template) {
if (template == null) {
return null;
}
DiscountedPriceImpl instance = new DiscountedPriceImpl();
instance.setValue(com.commercetools.importapi.models.common.TypedMoney.deepCopy(template.getValue()));
instance.setDiscount(
com.commercetools.importapi.models.common.ProductDiscountKeyReference.deepCopy(template.getDiscount()));
return instance;
}
/**
* builder factory method for DiscountedPrice
* @return builder
*/
public static DiscountedPriceBuilder builder() {
return DiscountedPriceBuilder.of();
}
/**
* create builder for DiscountedPrice instance
* @param template instance with prefilled values for the builder
* @return builder
*/
public static DiscountedPriceBuilder builder(final DiscountedPrice template) {
return DiscountedPriceBuilder.of(template);
}
/**
* accessor map function
* @param mapped type
* @param helper function to map the object
* @return mapped value
*/
default T withDiscountedPrice(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";
}
};
}
}