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

io.sphere.sdk.customobjects.queries.CustomObjectByIdGet Maven / Gradle / Ivy

There is a newer version: 1.0.0-M26
Show 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.json.TypeReferences;
import io.sphere.sdk.queries.Get;

/**
 * {@link io.sphere.sdk.client.SphereRequest} to fetch one {@link CustomObject} by id.
 *
 * {@include.example io.sphere.sdk.customobjects.queries.CustomObjectByIdGetTest#execution()}
 *
 * @param  The type of the value of the custom object.
 * @see CustomObject
 */
public interface CustomObjectByIdGet extends Get> {

    /**
     * Creates an object to fetch a custom object by id with POJO mapping.
     * @param id id 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  CustomObjectByIdGet of(final String id, final Class valueClass) {
        return new CustomObjectByIdGetImpl<>(id, valueClass);
    }

    /**
     * Creates an object to fetch a custom object by the container and key with POJO mapping.
     * @param id id 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  CustomObjectByIdGet of(final String id, final TypeReference valueTypeReference) {
        return new CustomObjectByIdGetImpl<>(id, valueTypeReference);
    }

    /**
     * Creates an object to fetch a custom object by the container and get the result as {@link JsonNode}.
     * @param id id of the custom object to fetch
     * @return query object
     */
    static CustomObjectByIdGet ofJsonNode(final String id) {
        return of(id, TypeReferences.jsonNodeTypeReference());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy