io.sphere.sdk.carts.ExternalTaxAmountDraftDsl Maven / Gradle / Ivy
The newest version!
package io.sphere.sdk.carts;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.sphere.sdk.models.Base;
import io.sphere.sdk.taxcategories.ExternalTaxRateDraft;
import javax.annotation.Generated;
import javax.money.MonetaryAmount;
/**
* Dsl class for {@link ExternalTaxAmountDraft}.
*/
@Generated(
value = "io.sphere.sdk.annotations.processors.generators.ResourceDraftValueGenerator",
comments = "Generated from: io.sphere.sdk.carts.ExternalTaxAmountDraft"
)
public final class ExternalTaxAmountDraftDsl extends Base implements ExternalTaxAmountDraft {
private ExternalTaxRateDraft taxRate;
private MonetaryAmount totalGross;
@JsonCreator
ExternalTaxAmountDraftDsl(final ExternalTaxRateDraft taxRate, final MonetaryAmount totalGross) {
this.taxRate = taxRate;
this.totalGross = totalGross;
}
public ExternalTaxRateDraft getTaxRate() {
return taxRate;
}
public MonetaryAmount getTotalGross() {
return totalGross;
}
/**
* Creates a new builder with the values of this object.
*
* @return new builder
*/
public ExternalTaxAmountDraftBuilder newBuilder() {
return new ExternalTaxAmountDraftBuilder(taxRate, totalGross);
}
public ExternalTaxAmountDraftDsl withTaxRate(final ExternalTaxRateDraft taxRate) {
return newBuilder().taxRate(taxRate).build();
}
public ExternalTaxAmountDraftDsl withTotalGross(final MonetaryAmount totalGross) {
return newBuilder().totalGross(totalGross).build();
}
/**
* Creates a new object initialized with the given values.
*
* @param totalGross initial value for the {@link ExternalTaxAmountDraft#getTotalGross()} property
* @param taxRate initial value for the {@link ExternalTaxAmountDraft#getTaxRate()} property
* @return new object initialized with the given values
*/
public static ExternalTaxAmountDraftDsl of(final MonetaryAmount totalGross,
final ExternalTaxRateDraft taxRate) {
return new ExternalTaxAmountDraftDsl(taxRate, totalGross);
}
/**
* Creates a new object initialized with the fields of the template parameter.
*
* @param template the template
* @return a new object initialized from the template
*/
public static ExternalTaxAmountDraftDsl of(final ExternalTaxAmountDraft template) {
return new ExternalTaxAmountDraftDsl(template.getTaxRate(), template.getTotalGross());
}
}