public final class TextLineItemReferenceResolver extends CustomReferenceResolver<io.sphere.sdk.shoppinglists.TextLineItemDraft,io.sphere.sdk.shoppinglists.TextLineItemDraftBuilder,ShoppingListSyncOptions>
TYPE_DOES_NOT_EXIST
BLANK_ID_VALUE_ON_REFERENCE, BLANK_KEY_VALUE_ON_RESOURCE_IDENTIFIER, options
Constructor and Description |
---|
TextLineItemReferenceResolver(ShoppingListSyncOptions shoppingListSyncOptions,
TypeService typeService)
Takes a
ShoppingListSyncOptions instance, a TypeService to instantiate a TextLineItemReferenceResolver instance that could be used to resolve the text line-item drafts
in the CTP project specified in the injected ShoppingListSyncOptions instance. |
Modifier and Type | Method and Description |
---|---|
protected java.util.concurrent.CompletionStage<io.sphere.sdk.shoppinglists.TextLineItemDraftBuilder> |
resolveCustomTypeReference(io.sphere.sdk.shoppinglists.TextLineItemDraftBuilder draftBuilder)
Given a draft of
D (e.g. |
java.util.concurrent.CompletionStage<io.sphere.sdk.shoppinglists.TextLineItemDraft> |
resolveReferences(io.sphere.sdk.shoppinglists.TextLineItemDraft textLineItemDraft)
Given a
TextLineItemDraft this method attempts to resolve the attribute definition
references to return a CompletionStage which contains a new instance of the draft with
the resolved references. |
resolveCustomTypeReference
getIdFromReference, getKeyFromResourceIdentifier
public TextLineItemReferenceResolver(@Nonnull ShoppingListSyncOptions shoppingListSyncOptions, @Nonnull TypeService typeService)
ShoppingListSyncOptions
instance, a TypeService
to instantiate a TextLineItemReferenceResolver
instance that could be used to resolve the text line-item drafts
in the CTP project specified in the injected ShoppingListSyncOptions
instance.shoppingListSyncOptions
- the container of all the options of the sync process including
the CTP project client and/or configuration and other sync-specific options.typeService
- the service to fetch the types for reference resolution.@Nonnull public java.util.concurrent.CompletionStage<io.sphere.sdk.shoppinglists.TextLineItemDraft> resolveReferences(@Nonnull io.sphere.sdk.shoppinglists.TextLineItemDraft textLineItemDraft)
TextLineItemDraft
this method attempts to resolve the attribute definition
references to return a CompletionStage
which contains a new instance of the draft with
the resolved references.resolveReferences
in class BaseReferenceResolver<io.sphere.sdk.shoppinglists.TextLineItemDraft,ShoppingListSyncOptions>
textLineItemDraft
- the textLineItemDraft to resolve its references.CompletionStage
that contains as a result a new textLineItemDraft instance
with resolved references or, in case an error occurs during reference resolution, a ReferenceResolutionException
.@Nonnull protected java.util.concurrent.CompletionStage<io.sphere.sdk.shoppinglists.TextLineItemDraftBuilder> resolveCustomTypeReference(@Nonnull io.sphere.sdk.shoppinglists.TextLineItemDraftBuilder draftBuilder)
CustomReferenceResolver
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 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).
resolveCustomTypeReference
in class CustomReferenceResolver<io.sphere.sdk.shoppinglists.TextLineItemDraft,io.sphere.sdk.shoppinglists.TextLineItemDraftBuilder,ShoppingListSyncOptions>
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
.