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

io.sphere.sdk.orders.commands.updateactions.SetCustomLineItemCustomField Maven / Gradle / Ivy

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

import com.fasterxml.jackson.databind.JsonNode;
import io.sphere.sdk.json.SphereJsonUtils;
import io.sphere.sdk.orders.Order;
import io.sphere.sdk.types.customupdateactions.SetCustomFieldBase;

/**
 * Updates a custom field in a custom line item.
 *
 * @see io.sphere.sdk.types.Custom
 */
public class SetCustomLineItemCustomField extends SetCustomFieldBase {
    private final String customLineItemId;

    private SetCustomLineItemCustomField(final String name, final JsonNode value, final String customLineItemId) {
        super("setCustomLineItemCustomField", name, value);
        this.customLineItemId = customLineItemId;
    }

    public static SetCustomLineItemCustomField ofJson(final String name, final JsonNode value, final String customLineItemId) {
        return new SetCustomLineItemCustomField(name, value, customLineItemId);
    }

    public static SetCustomLineItemCustomField ofObject(final String name, final Object value, final String customLineItemId) {
        final JsonNode jsonNode = SphereJsonUtils.toJsonNode(value);
        return ofJson(name, jsonNode, customLineItemId);
    }

    public static SetCustomLineItemCustomField ofUnset(final String name, final String customLineItemId) {
        return ofJson(name, null, customLineItemId);
    }

    public String getCustomLineItemId() {
        return customLineItemId;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy