io.sphere.sdk.customobjects.queries.CustomObjectByKeyGet Maven / Gradle / Ivy
The newest version!
package io.sphere.sdk.customobjects.queries;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import io.sphere.sdk.customobjects.CustomObject;
import io.sphere.sdk.customobjects.expansion.CustomObjectExpansionModel;
import io.sphere.sdk.expansion.ExpansionPath;
import io.sphere.sdk.json.SphereJsonUtils;
import io.sphere.sdk.json.TypeReferences;
import io.sphere.sdk.queries.Get;
import io.sphere.sdk.queries.MetaModelGetDsl;
import java.util.List;
/**
* {@link io.sphere.sdk.client.SphereRequest} to fetch one {@link io.sphere.sdk.customobjects.CustomObject} by container and key.
*
* {@include.example io.sphere.sdk.customobjects.queries.CustomObjectByKeyGetIntegrationTest#execution()}
*
* @param The type of the value of the custom object.
* @see CustomObject
*/
public interface CustomObjectByKeyGet extends MetaModelGetDsl, CustomObject, CustomObjectByKeyGet, CustomObjectExpansionModel>> {
/**
* Creates an object to fetch a custom object by the container and key with POJO mapping.
* @param container container of the custom object to fetch
* @param key key of the custom object to fetch
* @param valueClass the class of the value, if it not uses generics like lists, typically for POJOs
* @param the type of the value in the custom object
* @return query object
*/
static CustomObjectByKeyGet of(final String container, final String key, final Class valueClass) {
return new CustomObjectByKeyGetImpl(container, key, SphereJsonUtils.convertToJavaType(valueClass));
}
/**
* Creates an object to fetch a custom object by the container and key with POJO mapping.
* @param container container of the custom object to fetch
* @param key key of the custom object to fetch
* @param valueTypeReference the type reference of the value of the custom object
* @param the type of the value in the custom object
* @return query object
*/
static CustomObjectByKeyGet of(final String container, final String key, final TypeReference valueTypeReference) {
return new CustomObjectByKeyGetImpl(container, key, SphereJsonUtils.convertToJavaType(valueTypeReference));
}
/**
* Creates an object to fetch a custom object by the container and get the result as {@link JsonNode}.
* @param container container of the custom object to fetch
* @param key key of the custom object to fetch
* @return query object
*/
static CustomObjectByKeyGet ofJsonNode(final String container, final String key) {
return of(container, key, TypeReferences.jsonNodeTypeReference());
}
@Override
List>> expansionPaths();
@Override
CustomObjectByKeyGet plusExpansionPaths(final ExpansionPath> expansionPath);
@Override
CustomObjectByKeyGet withExpansionPaths(final ExpansionPath> expansionPath);
@Override
CustomObjectByKeyGet withExpansionPaths(final List>> expansionPaths);
}