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

io.sphere.sdk.customers.commands.updateactions.SetCustomerGroup Maven / Gradle / Ivy

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

import io.sphere.sdk.commands.UpdateAction;
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 java.util.Optional;

/**
 *
 * {@include.example io.sphere.sdk.customers.commands.CustomerUpdateCommandTest#setCustomerGroup()}
 */
public class SetCustomerGroup extends UpdateAction {
    private final Optional> customerGroup;

    private SetCustomerGroup(final Optional> customerGroup) {
        super("setCustomerGroup");
        this.customerGroup = customerGroup.map(e -> e.filled(Optional.empty()));
    }

    public static SetCustomerGroup of(final Optional> customerGroup) {
        return new SetCustomerGroup(customerGroup);
    }

    public static SetCustomerGroup of(final Referenceable customerGroup) {
        return of(Optional.of(customerGroup.toReference()));
    }

    public Optional> getCustomerGroup() {
        return customerGroup;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy