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

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

There is a newer version: 1.0.0-M12
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.http.JsonEndpoint;
import io.sphere.sdk.queries.FetchImpl;

/**
 * {@link io.sphere.sdk.client.SphereRequest} to fetch one {@link io.sphere.sdk.customobjects.CustomObject} by container and key.
 * @param  The type of the value of the custom object.
 */
public class CustomObjectFetchByKey extends FetchImpl> {

    private static final TypeReference> JSON_NODE_TYPE_REFERENCE = new TypeReference>() {
        @Override
        public String toString() {
            return "TypeReference>";
        }
    };

    private CustomObjectFetchByKey(final TypeReference> typeReference, final String container, final String key) {
        super(JsonEndpoint.of(typeReference, CustomObjectsEndpoint.PATH), "" + container + "/" + key);
    }

    public static  CustomObjectFetchByKey of(final String container, final String key, final TypeReference> typeReference) {
        return new CustomObjectFetchByKey<>(typeReference, container, key);
    }

    public static CustomObjectFetchByKey of(final String container, final String key) {
        return of(container, key, JSON_NODE_TYPE_REFERENCE);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy