io.sphere.sdk.shippingmethods.expansion.ShippingMethodExpansionModelImpl Maven / Gradle / Ivy
The newest version!
package io.sphere.sdk.shippingmethods.expansion;
import io.sphere.sdk.expansion.ExpansionModelImpl;
import io.sphere.sdk.taxcategories.expansion.TaxCategoryExpansionModel;
import io.sphere.sdk.zones.expansion.ZoneExpansionModel;
import javax.annotation.Nullable;
import java.util.List;
/**
DSL class to create expansion path expressions.
@param the type for which the expansion path is
*/
final class ShippingMethodExpansionModelImpl extends ExpansionModelImpl implements ShippingMethodExpansionModel {
ShippingMethodExpansionModelImpl(final List parentPath, @Nullable final String path) {
super(parentPath, path);
}
ShippingMethodExpansionModelImpl() {
super();
}
@Override
public TaxCategoryExpansionModel taxCategory() {
return TaxCategoryExpansionModel.of(buildPathExpression(), "taxCategory");
}
@Override
public ZoneRateExpansionModel zoneRates() {
return zoneRates("*");
}
@Override
public ZoneRateExpansionModel zoneRates(final int index) {
return zoneRates("" + index);
}
@Override
public ZoneExpansionModel zones() {
return zoneRates().zone();
}
@Override
public ZoneExpansionModel zones(final int index) {
return zoneRates(index).zone();
}
private ZoneRateExpansionModel zoneRates(final String s) {
return new ZoneRateExpansionModelImpl<>(pathExpression(), "zoneRates[" + s + "]");
}
}