public final class VariantReferenceResolver extends BaseReferenceResolver<io.sphere.sdk.products.ProductVariantDraft,ProductSyncOptions>
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
REFERENCE_ID_FIELD |
static java.lang.String |
REFERENCE_TYPE_ID_FIELD |
options| Constructor and Description |
|---|
VariantReferenceResolver(ProductSyncOptions productSyncOptions,
TypeService typeService,
ChannelService channelService,
ProductService productService)
Takes a
ProductSyncOptions instance, TypeService, a ChannelService and a
ProductService to instantiate a VariantReferenceResolver instance that could be used to resolve
the prices and variants of variant drafts in the CTP project specified in the injected ProductSyncOptions
instance. |
| Modifier and Type | Method and Description |
|---|---|
java.util.concurrent.CompletionStage<io.sphere.sdk.products.ProductVariantDraft> |
resolveReferences(io.sphere.sdk.products.ProductVariantDraft productVariantDraft)
Given a
ProductVariantDraft this method attempts to resolve the prices and attributes to
return a CompletionStage which contains a new instance of the draft with the resolved
references. |
getKeyFromExpansionOrReference, getKeyFromResourceIdentifier, isReferenceExpandedpublic static final java.lang.String REFERENCE_TYPE_ID_FIELD
public static final java.lang.String REFERENCE_ID_FIELD
public VariantReferenceResolver(@Nonnull
ProductSyncOptions productSyncOptions,
@Nonnull
TypeService typeService,
@Nonnull
ChannelService channelService,
@Nonnull
ProductService productService)
ProductSyncOptions instance, TypeService, a ChannelService and a
ProductService to instantiate a VariantReferenceResolver instance that could be used to resolve
the prices and variants of variant drafts in the CTP project specified in the injected ProductSyncOptions
instance.productSyncOptions - 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 custom types for reference resolution.channelService - the service to fetch the channels for reference resolution.productService - the service to fetch the products for reference resolution.public java.util.concurrent.CompletionStage<io.sphere.sdk.products.ProductVariantDraft> resolveReferences(@Nonnull
io.sphere.sdk.products.ProductVariantDraft productVariantDraft)
ProductVariantDraft this method attempts to resolve the prices and attributes to
return a CompletionStage which contains a new instance of the draft with the resolved
references. The keys of the references are either taken from the expanded references or
taken from the id field of the references.resolveReferences in class BaseReferenceResolver<io.sphere.sdk.products.ProductVariantDraft,ProductSyncOptions>productVariantDraft - the product variant draft to resolve it's references.CompletionStage that contains as a result a new productDraft instance with resolved references
or, in case an error occurs during reference resolution, a ReferenceResolutionException.