io.sphere.sdk.carts.expansion.CartLikeExpansionModelImpl Maven / Gradle / Ivy
package io.sphere.sdk.carts.expansion;
import io.sphere.sdk.customergroups.expansion.CustomerGroupExpansionModel;
import io.sphere.sdk.expansion.ExpansionModelImpl;
import java.util.List;
/**
* Internal base class
* @param context type like {@link io.sphere.sdk.orders.Order} or {@link io.sphere.sdk.carts.Cart}
*/
public abstract class CartLikeExpansionModelImpl extends ExpansionModelImpl implements CartLikeExpansionModel {
protected CartLikeExpansionModelImpl(final List parentPath, final String path) {
super(parentPath, path);
}
protected CartLikeExpansionModelImpl() {
super();
}
@Override
public CustomerGroupExpansionModel customerGroup() {
return CustomerGroupExpansionModel.of(buildPathExpression(), "customerGroup");
}
@Override
public DiscountCodeInfoExpansionModel discountCodes() {
return discountCodes("*");
}
@Override
public DiscountCodeInfoExpansionModel discountCodes(final int index) {
return discountCodes("" + index);
}
@Override
public LineItemExpansionModel lineItems() {
return new LineItemExpansionModelImpl<>(pathExpression(), "lineItems[*]");
}
@Override
public LineItemExpansionModel lineItems(final int index) {
return new LineItemExpansionModelImpl<>(pathExpression(), "lineItems[" + index + "]");
}
@Override
public CustomLineItemExpansionModel customLineItems() {
return new CustomLineItemExpansionModelImpl<>(pathExpression(), "customLineItems[*]");
}
@Override
public CustomLineItemExpansionModel customLineItems(final int index) {
return new CustomLineItemExpansionModelImpl<>(pathExpression(), "customLineItems[" + index + "]");
}
@Override
public PaymentInfoExpansionModel paymentInfo() {
return new PaymentInfoExpansionModelImpl<>(buildPathExpression(), "paymentInfo");
}
private DiscountCodeInfoExpansionModel discountCodes(final String s) {
return new DiscountCodeInfoExpansionModelImpl<>(pathExpression(), "discountCodes[" + s + "]");
}
@Override
public ShippingInfoExpansionModel shippingInfo() {
return new ShippingInfoExpansionModelImpl<>(pathExpression(), "shippingInfo");
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy