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

io.sphere.sdk.customobjects.commands.CustomObjectDeleteCommand Maven / Gradle / Ivy

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

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import io.sphere.sdk.commands.DeleteCommand;
import io.sphere.sdk.customobjects.CustomObject;
import io.sphere.sdk.json.TypeReferences;

/**
 * 

Deletes a custom object in SPHERE.IO.

* * {@include.example io.sphere.sdk.customobjects.commands.CustomObjectDeleteCommandTest#demo()} * * @param type of the value of the custom object * @see CustomObject */ public interface CustomObjectDeleteCommand extends DeleteCommand> { /** * Deletes a custom object without optimistic concurrency control and uses the delete endpoint via container and key and returns the old custom object with the in {@code valueTypeReference}specified value type. * @param customObject the custom object to delete * @param valueTypeReference the type reference to deserialize the updated custom object from the SPHERE.IO response * @param type of the value of the custom object * @return custom object */ static DeleteCommand> of(final CustomObject customObject, final TypeReference valueTypeReference) { return of(customObject.getContainer(), customObject.getKey(), valueTypeReference); } /** * Deletes a custom object without optimistic concurrency control and uses the delete endpoint via container and key and returns the old custom object with the in {@code valueTypeReference}specified value type. * @param customObject the custom object to delete * @param valueClass the class of the value, if it not uses generics like lists, typically for POJOs * @param type of the value of the custom object * @return custom object */ static DeleteCommand> of(final CustomObject customObject, final Class valueClass) { return of(customObject.getContainer(), customObject.getKey(), valueClass); } /** * Deletes a custom object without optimistic concurrency control and uses the delete endpoint via container and key and returns the old custom object with the in {@code valueTypeReference}specified value type. * @param container the container name of the custom object to delete * @param key the key name of the custom object to delete * @param valueTypeReference the type reference to deserialize the updated custom object from the SPHERE.IO response * @param type of the value of the custom object * @return custom object with a JsonNode value */ static DeleteCommand> of(final String container, final String key, final TypeReference valueTypeReference) { return new CustomObjectDeleteCommandImpl<>(container, key, valueTypeReference); } /** * Deletes a custom object without optimistic concurrency control and uses the delete endpoint via container and key and returns the old custom object with the in {@code valueTypeReference}specified value type. * @param container the container name of the custom object to delete * @param key the key name of the custom object to delete * @param valueClass the class of the value, if it not uses generics like lists, typically for POJOs * @param type of the value of the custom object * @return custom object with a JsonNode value */ static DeleteCommand> of(final String container, final String key, final Class valueClass) { return new CustomObjectDeleteCommandImpl<>(container, key, valueClass); } /** * Deletes a custom object without optimistic concurrency control and uses the delete endpoint via container and key and returns the old custom object with a JsonNode value type. * Convenience method to not specify the {@link com.fasterxml.jackson.core.type.TypeReference} but lacking the accessible value in the result. * @param customObject the custom object to delete * @return custom object with a JsonNode value */ static DeleteCommand> ofJsonNode(final CustomObject customObject) { return ofJsonNode(customObject.getContainer(), customObject.getKey()); } /** * * @deprecated use {@link #ofJsonNode(CustomObject)} instead * @param customObject customObject * @return DeleteCommand */ @Deprecated static DeleteCommand> of(final CustomObject customObject) { return ofJsonNode(customObject); } /** * Deletes a custom object without optimistic concurrency control and returns the old custom object with a JsonNode value type. * Convenience method to not specify the {@link com.fasterxml.jackson.core.type.TypeReference} but lacking the accessible value in the result. * @param container the container name of the custom object to delete * @param key the key name of the custom object to delete * @return custom object with a JsonNode value */ static DeleteCommand> ofJsonNode(final String container, final String key) { return new CustomObjectDeleteCommandImpl<>(container, key, TypeReferences.jsonNodeTypeReference()); } /** * * @deprecated use {@link #ofJsonNode(String, String)} instead * @param container container * @param key key * @return DeleteCommand */ @Deprecated static DeleteCommand> of(final String container, final String key) { return ofJsonNode(container, key); } /** * Deletes a custom object by id with optimistic concurrency control and returns the old custom object with a JsonNode value type. * Convenience method to not specify the {@link com.fasterxml.jackson.core.type.TypeReference} but lacking the accessible value in the result. * @param id the id of the custom object to delete * @param version the version of the custom object to delete * @return custom object with a JsonNode value */ static DeleteCommand> ofJsonNode(final String id, final Long version) { return of(id, version, TypeReferences.jsonNodeTypeReference()); } /** * Deletes a custom object by id with optimistic concurrency control and returns the old custom object with the in {@code valueTypeReference} specified value type. * Convenience method to not specify the {@link com.fasterxml.jackson.core.type.TypeReference} but lacking the accessible value in the result. * @param id the id of the custom object to delete * @param version the version of the custom object to delete * @param valueTypeReference the type reference to deserialize the updated custom object from the SPHERE.IO response * @param type of the value of the custom object * @return custom object with a JsonNode value */ static DeleteCommand> of(final String id, final Long version, final TypeReference valueTypeReference) { return new CustomObjectDeleteCommandImpl<>(id, version, valueTypeReference); } /** * Deletes a custom object by id with optimistic concurrency control and returns the old custom object with the in {@code valueClass} specified value type. * * {@include.example io.sphere.sdk.customobjects.commands.CustomObjectDeleteCommandTest#demoById()} * * @param id the id of the custom object to delete * @param version the version of the custom object to delete * @param valueClass the class of the value, if it not uses generics like lists, typically for POJOs * @param type of the value of the custom object * @return custom object with a JsonNode value */ static DeleteCommand> of(final String id, final Long version, final Class valueClass) { return new CustomObjectDeleteCommandImpl<>(id, version, valueClass); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy