io.sphere.sdk.extensions.commands.ExtensionUpdateCommand Maven / Gradle / Ivy
/*
This class has been generated by class io.sphere.sdk.annotations.processors.UpdateCommandEndpointAnnotationProcessor
induced by the annotation io.sphere.sdk.annotations.HasUpdateCommand.
in the source class io.sphere.sdk.extensions.Extension.
To render this class the handlebars template 'commands/updateCommandInterface.hbs' has been used.
*/
package io.sphere.sdk.extensions.commands;
import io.sphere.sdk.commands.UpdateAction;
import io.sphere.sdk.commands.UpdateCommandDsl;
import io.sphere.sdk.expansion.MetaModelReferenceExpansionDsl;
import io.sphere.sdk.models.Versioned;
import io.sphere.sdk.extensions.Extension;
import io.sphere.sdk.extensions.expansion.ExtensionExpansionModel;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static io.sphere.sdk.client.SphereRequestUtils.urlEncode;
/**
Updates an extension.
{@doc.gen list actions}
@see Extension
*/
public interface ExtensionUpdateCommand extends UpdateCommandDsl, MetaModelReferenceExpansionDsl> {
/**
Creates a command to update a Extension selected by its ID using several update actions.
@param versioned the object to update (so directly a {@link Extension}) or just the version/ID information of it
@param updateActions the updates
@return the update command for Extension
*/
static ExtensionUpdateCommand of(final Versioned versioned, final List extends UpdateAction> updateActions) {
return new ExtensionUpdateCommandImpl(versioned, updateActions);
}
/**
Creates a command to update a Extension selected by its ID using one update action.
@param versioned the object to update (so directly a {@link Extension}) or just the version/ID information of it
@param updateAction the update to perform
@param updateActions additional updates to perform
@return the update command for Extension
*/
@SafeVarargs
static ExtensionUpdateCommand of(final Versioned versioned, final UpdateAction updateAction, final UpdateAction... updateActions) {
final List> actions = new ArrayList<>();
actions.add(updateAction);
actions.addAll(Arrays.asList(updateActions));
return new ExtensionUpdateCommandImpl(versioned, actions);
}
/**
Creates a command to update a Extension selected by its key using several update actions.
@param key the key of the Extension to update, see {@link Extension#getKey()}
@param version the current version of the Extension, see {@link Extension#getVersion()}
@param updateActions the updates
@return the update command for Extension
*/
static ExtensionUpdateCommand ofKey(final String key, final Long version, final List extends UpdateAction> updateActions) {
final Versioned versioned = Versioned.of("key=" + urlEncode(key), version);//hack for simple reuse
return new ExtensionUpdateCommandImpl(versioned, updateActions);
}
/**
Creates a command to update a Extension selected by its key using one update action.
@param key the key of the Extension to update, see {@link Extension#getKey()}
@param version the current version of the Extension, see {@link Extension#getVersion()}
@param updateAction the update to perform
@return the update command for Extension
*/
static ExtensionUpdateCommand ofKey(final String key, final Long version, final UpdateAction updateAction) {
return ofKey(key, version, Collections.singletonList(updateAction));
}
/**
Creates a command to update a Extension selected by its id using several update actions.
@param id the id of the Extension to update, see {@link Extension#getId()}
@param version the current version of the Extension, see {@link Extension#getVersion()}
@param updateActions the updates
@return the update command for Extension
*/
static ExtensionUpdateCommand ofId(final String id, final Long version, final List extends UpdateAction> updateActions) {
final Versioned versioned = Versioned.of("id=" + urlEncode(id), version);//hack for simple reuse
return new ExtensionUpdateCommandImpl(versioned, updateActions);
}
/**
Creates a command to update a Extension selected by its id using one update action.
@param id the id of the Extension to update, see {@link Extension#getId()}
@param version the current version of the Extension, see {@link Extension#getVersion()}
@param updateAction the update to perform
@return the update command for Extension
*/
static ExtensionUpdateCommand ofId(final String id, final Long version, final UpdateAction updateAction) {
return ofId(id, version, Collections.singletonList(updateAction));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy