T - the resource draft type for which reference resolution has to be done on.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 CustomReferenceResolver<T extends io.sphere.sdk.types.CustomDraft,S extends BaseSyncOptions> extends BaseReferenceResolver<T,S>
options| Modifier | Constructor and Description |
|---|---|
protected |
CustomReferenceResolver(S options,
TypeService typeService) |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.concurrent.CompletionStage<java.util.Optional<java.lang.String>> |
getCustomTypeId(io.sphere.sdk.types.CustomFieldsDraft custom,
java.lang.String referenceResolutionErrorMessage)
Given a custom fields object this method fetches the custom type reference id.
|
protected abstract java.util.concurrent.CompletionStage<T> |
resolveCustomTypeReference(T draft)
Given a draft of
T (e.g. |
getKeyFromExpansionOrReference, getKeyFromResourceIdentifier, isReferenceExpanded, resolveReferencesprotected CustomReferenceResolver(@Nonnull
S options,
@Nonnull
TypeService typeService)
protected abstract java.util.concurrent.CompletionStage<T> resolveCustomTypeReference(@Nonnull T draft)
T (e.g. CategoryDraft) this method attempts to resolve it's custom type
reference to return CompletionStage which contains a new instance of the draft with the resolved
custom type reference. The key of the custom type is taken from the from the id field of the reference.
The method then tries to fetch the key of the custom type, optimistically from a cache. If the key is is not found, the resultant draft would remain exactly the same as the passed draft (without a custom type reference resolution).
draft - the draft to resolve it's references.CompletionStage that contains as a result a new draft instance with resolved custom
type references or, in case an error occurs during reference resolution,
a ReferenceResolutionException.protected java.util.concurrent.CompletionStage<java.util.Optional<java.lang.String>> getCustomTypeId(@Nonnull
io.sphere.sdk.types.CustomFieldsDraft custom,
@Nonnull
java.lang.String referenceResolutionErrorMessage)
custom - the custom fields object.referenceResolutionErrorMessage - the message containing the information about the draft to attach to the
ReferenceResolutionException in case it occurs.CompletionStage that contains as a result an optional which either contains the custom type id
if it exists or empty if it doesn't.