io.sphere.sdk.customers.commands.updateactions.SetCustomerGroup Maven / Gradle / Ivy
package io.sphere.sdk.customers.commands.updateactions;
import io.sphere.sdk.commands.UpdateActionImpl;
import io.sphere.sdk.customergroups.CustomerGroup;
import io.sphere.sdk.customers.Customer;
import io.sphere.sdk.models.Reference;
import io.sphere.sdk.models.Referenceable;
import javax.annotation.Nullable;
import java.util.Optional;
/**
* Sets the customer group for a customer.
*
* {@doc.gen intro}
*
* {@include.example io.sphere.sdk.customers.commands.CustomerUpdateCommandTest#setCustomerGroup()}
*
* @see Customer
*/
public class SetCustomerGroup extends UpdateActionImpl {
@Nullable
private final Reference customerGroup;
private SetCustomerGroup(final Referenceable customerGroup) {
super("setCustomerGroup");
this.customerGroup = Optional.ofNullable(customerGroup)
.map(x -> x.toReference().filled(null))
.orElse(null);
}
public static SetCustomerGroup of(@Nullable final Referenceable customerGroup) {
return new SetCustomerGroup(customerGroup);
}
@Nullable
public Reference getCustomerGroup() {
return customerGroup;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy