S - a subclass implementation of BaseSyncOptions that is used to allow/deny some
specific options, specified by the user, on reference resolution.public abstract class BaseReferenceResolver<T,S extends BaseSyncOptions>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
BLANK_ID_VALUE_ON_REFERENCE |
static java.lang.String |
BLANK_KEY_VALUE_ON_RESOURCE_IDENTIFIER |
protected S |
options |
| Modifier | Constructor and Description |
|---|---|
protected |
BaseReferenceResolver(S options) |
| Modifier and Type | Method and Description |
|---|---|
protected static <T> java.lang.String |
getIdFromReference(io.sphere.sdk.models.Reference<T> reference)
This method gets the key value on the passed
Reference from the id field, if valid. |
protected static <T> java.lang.String |
getKeyFromResourceIdentifier(io.sphere.sdk.models.ResourceIdentifier<T> resourceIdentifier)
This method gets the key value on the passed
ResourceIdentifier, if valid. |
abstract java.util.concurrent.CompletionStage<T> |
resolveReferences(T draft)
Given a draft this method attempts to resolve the all the references on the draft to return a
CompletionStage which contains a new instance of the draft with the resolved
references. |
public static final java.lang.String BLANK_KEY_VALUE_ON_RESOURCE_IDENTIFIER
public static final java.lang.String BLANK_ID_VALUE_ON_REFERENCE
protected S extends BaseSyncOptions options
protected BaseReferenceResolver(@Nonnull
S options)
public abstract java.util.concurrent.CompletionStage<T> resolveReferences(@Nonnull T draft)
CompletionStage which contains a new instance of the draft with the resolved
references.draft - the productDraft to resolve it's references.CompletionStage that contains as a result a new draft instance with resolved
references or, in case an error occurs during reference resolution, a ReferenceResolutionException.@Nonnull
protected static <T> java.lang.String getIdFromReference(@Nonnull
io.sphere.sdk.models.Reference<T> reference)
throws ReferenceResolutionException
Reference from the id field, if valid. If
it is not valid, a ReferenceResolutionException will be thrown. The validity checks
are:
ReferenceResolutionException is thrown.T - the type of the reference.reference - the reference from which the key value is validated and returned.ResourceIdentifierReferenceResolutionException - if any of the validation checks fail.@Nonnull
protected static <T> java.lang.String getKeyFromResourceIdentifier(@Nonnull
io.sphere.sdk.models.ResourceIdentifier<T> resourceIdentifier)
throws ReferenceResolutionException
ResourceIdentifier, if valid. If it is not
valid, a ReferenceResolutionException will be thrown. The validity checks are:
ReferenceResolutionException is thrown.T - the type of the reference.resourceIdentifier - the resource identifier from which the key value is validated and
returned.ResourceIdentifierReferenceResolutionException - if any of the validation checks fail.