io.sphere.sdk.carts.expansion.LineItemExpansionModelImpl Maven / Gradle / Ivy
package io.sphere.sdk.carts.expansion;
import io.sphere.sdk.channels.expansion.ChannelExpansionModel;
import io.sphere.sdk.expansion.ExpansionModelImpl;
import io.sphere.sdk.products.expansion.ProductVariantExpansionModel;
import io.sphere.sdk.producttypes.expansion.ProductTypeExpansionModel;
import java.util.List;
final class LineItemExpansionModelImpl extends ExpansionModelImpl implements LineItemExpansionModel {
LineItemExpansionModelImpl(final List parentPath, final String path) {
super(parentPath, path);
}
@Override
public ChannelExpansionModel supplyChannel() {
return ChannelExpansionModel.of(buildPathExpression(), "supplyChannel");
}
@Override
public ChannelExpansionModel distributionChannel() {
return ChannelExpansionModel.of(buildPathExpression(), "distributionChannel");
}
@Override
public ItemStateExpansionModel state() {
return state("*");
}
@Override
public ItemStateExpansionModel state(final int index) {
return state("" + index);
}
@Override
public ProductVariantExpansionModel variant() {
return ProductVariantExpansionModel.of(buildPathExpression(), "variant");
}
@Override
public DiscountedLineItemPricePerQuantityExpansionModel discountedPricePerQuantity() {
return discountedPricePerQuantity("*");
}
@Override
public DiscountedLineItemPricePerQuantityExpansionModel discountedPricePerQuantity(final int index) {
return discountedPricePerQuantity("" + index);
}
@Override
public ProductTypeExpansionModel productType() {
return ProductTypeExpansionModel.of(buildPathExpression(), "productType");
}
private ItemStateExpansionModel state(final String s) {
return new ItemStateExpansionModelImpl<>(pathExpression(), "state[" + s + "]");
}
private DiscountedLineItemPricePerQuantityExpansionModel discountedPricePerQuantity(final String s) {
return new DiscountedLineItemPricePerQuantityExpansionModelImpl<>(pathExpression(), "discountedPricePerQuantity[" + s + "]");
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy