io.sphere.sdk.carts.commands.updateactions.SetShippingMethod Maven / Gradle / Ivy
package io.sphere.sdk.carts.commands.updateactions;
import io.sphere.sdk.carts.Cart;
import io.sphere.sdk.commands.UpdateActionImpl;
import io.sphere.sdk.models.Reference;
import io.sphere.sdk.models.Referenceable;
import io.sphere.sdk.shippingmethods.ShippingMethod;
import javax.annotation.Nullable;
/**
* Sets the shipping method.
*
* {@doc.gen intro}
*
* {@include.example io.sphere.sdk.carts.commands.CartUpdateCommandTest#setShippingMethod()}
*/
public class SetShippingMethod extends UpdateActionImpl {
@Nullable
private final Reference shippingMethod;
private SetShippingMethod(@Nullable final Reference shippingMethod) {
super("setShippingMethod");
this.shippingMethod = shippingMethod;
}
public Reference getShippingMethod() {
return shippingMethod;
}
public static SetShippingMethod of(@Nullable final Referenceable shippingMethod) {
return shippingMethod != null
? new SetShippingMethod(shippingMethod.toReference())
: ofRemove();
}
public static SetShippingMethod ofRemove() {
return new SetShippingMethod(null);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy