D - the resource draft type for which reference resolution has to be done on.B - the resource draft builder where resolved values should be set. The builder type should correspond
the D type.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<D extends io.sphere.sdk.types.CustomDraft,B extends io.sphere.sdk.models.Builder<? extends D>,S extends BaseSyncOptions> extends BaseReferenceResolver<D,S>
BLANK_ID_VALUE_ON_RESOURCE_IDENTIFIER, options| Modifier | Constructor and Description |
|---|---|
protected |
CustomReferenceResolver(S options,
TypeService typeService) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract java.util.concurrent.CompletionStage<B> |
resolveCustomTypeReference(B draftBuilder)
Given a draft of
D (e.g. |
protected java.util.concurrent.CompletionStage<B> |
resolveCustomTypeReference(B draftBuilder,
java.util.function.Function<B,io.sphere.sdk.types.CustomFieldsDraft> customGetter,
java.util.function.BiFunction<B,io.sphere.sdk.types.CustomFieldsDraft,B> customSetter,
java.lang.String errorMessage)
Given a draft of
D (e.g. |
getKeyFromResourceIdentifier, resolveReferencesprotected CustomReferenceResolver(@Nonnull
S options,
@Nonnull
TypeService typeService)
protected abstract java.util.concurrent.CompletionStage<B> resolveCustomTypeReference(@Nonnull B draftBuilder)
D (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).
draftBuilder - the draft builder 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.@Nonnull protected java.util.concurrent.CompletionStage<B> resolveCustomTypeReference(@Nonnull B draftBuilder, @Nonnull java.util.function.Function<B,io.sphere.sdk.types.CustomFieldsDraft> customGetter, @Nonnull java.util.function.BiFunction<B,io.sphere.sdk.types.CustomFieldsDraft,B> customSetter, @Nonnull java.lang.String errorMessage)
D (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).
draftBuilder - the draft builder to resolve it's references.customGetter - a function to return the CustomFieldsDraft instance of the draft builder.customSetter - a function to set the CustomFieldsDraft instance of the builder and return this builder.errorMessage - the error message to inject in the ReferenceResolutionException if it occurs.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.