Interface SkuFieldReferenceTypeUtility

All Known Implementing Classes:
DefaultSkuFieldReferenceTypeUtility

public interface SkuFieldReferenceTypeUtility
Utility to determine the SkuReferenceFieldType of a String value.
Author:
Kelly Tisdell (ktisdell)
See Also:
  • Method Details

    • determineSkuFieldReferenceType

      @NonNull SkuReferenceFieldType determineSkuFieldReferenceType(@NonNull String type, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      SkuRef has a number of fields that may be used to uniquely identify a SKU (e.g. upc, ean, skuContextId, etc.). When querying for SkuInventory, clients will provide a String to indicate which field they are referencing. It is assumed that one field will be referenced in any single call.
      Parameters:
      type -
      context -
      Returns:
      Throws:
      IllegalArgumentException
    • determineSkuRefValue

      @NonNull String determineSkuRefValue(@NonNull String type, @NonNull SkuRef skuRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Given a valid type and a valid SkuRef, this returns the value of the SkuRef field.
      Parameters:
      type -
      skuRef -
      context -
      Returns:
      Throws:
      IllegalArgumentException - - if type is null, if skuRef is null, if type is invalid, or if the associated skuRef field is null
    • determineSkuRefValue

      @NonNull String determineSkuRefValue(@NonNull SkuReferenceFieldType type, @NonNull SkuRef skuRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Given a valid SkuReferenceFieldType and a valid SkuRef, this returns the value of the SkuRef field.
      Parameters:
      type -
      skuRef -
      context -
      Returns:
      Throws:
      IllegalArgumentException - - if type is null, if skuRef is null, or if the associated skuRef field is null
    • mapValueToSkuRef

      @NonNull SkuRef mapValueToSkuRef(@NonNull SkuReferenceFieldType type, @NonNull String value, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Convenience utility method to create a SkuRef containing the right field value based on the provided SkuReferenceFieldType.
      Parameters:
      type -
      value -
      context -
      Returns:
    • mapValueToSkuRef

      @NonNull SkuRef mapValueToSkuRef(@NonNull String type, @NonNull String value, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Convenience utility method to create a SkuRef containing the right field value based on the String value provided that must resolve to SkuReferenceFieldType.
      Parameters:
      type -
      value -
      context -
      Returns: