io.sphere.sdk.customobjects.queries.CustomObjectByKeyFetch Maven / Gradle / Ivy
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.client.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 CustomObjectByKeyFetch extends FetchImpl> {
private static final TypeReference> JSON_NODE_TYPE_REFERENCE = new TypeReference>() {
@Override
public String toString() {
return "TypeReference>";
}
};
private CustomObjectByKeyFetch(final TypeReference> typeReference, final String container, final String key) {
super(JsonEndpoint.of(typeReference, CustomObjectsEndpoint.PATH), "" + container + "/" + key);
}
public static CustomObjectByKeyFetch of(final String container, final String key, final TypeReference> typeReference) {
return new CustomObjectByKeyFetch<>(typeReference, container, key);
}
public static CustomObjectByKeyFetch of(final String container, final String key) {
return of(container, key, JSON_NODE_TYPE_REFERENCE);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy