All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.carts.commands.updateactions.SetCustomerId Maven / Gradle / Ivy

There is a newer version: 1.0.0-M12
Show newest version
package io.sphere.sdk.carts.commands.updateactions;

import io.sphere.sdk.carts.Cart;
import io.sphere.sdk.commands.UpdateAction;
import io.sphere.sdk.customers.Customer;
import io.sphere.sdk.models.Referenceable;

import java.util.Optional;

/**
 

Sets an existing customer ID for a cart.

The customer ID can be unset by calling {@link io.sphere.sdk.carts.commands.updateactions.SetCustomerId#of(java.util.Optional)} with {@link java.util.Optional#empty()}. {@include.example io.sphere.sdk.carts.commands.CartUpdateCommandTest#setCustomerId()} */ public class SetCustomerId extends UpdateAction { private final Optional customerId; private SetCustomerId(final Optional customerId) { super("setCustomerId"); this.customerId = customerId; } public static SetCustomerId of(final Optional customerId) { return new SetCustomerId(customerId); } public static SetCustomerId of(final String customerId) { return of(Optional.of(customerId)); } public static SetCustomerId of(final Referenceable customer) { return of(Optional.of(customer.toReference().getId())); } public Optional getCustomerId() { return customerId; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy