Class SSCCValidator

java.lang.Object
tools.pantheum.gaia.gs1.content.validator.SSCCValidator
All Implemented Interfaces:
ContentInterface

public final class SSCCValidator extends Object implements ContentInterface
Custom semantic validator for AI 00 — Serial Shipping Container Code (SSCC).

The standard pipeline already verifies that the value is exactly 18 digits and that the modulo-10 check digit (last digit) is correct. This validator applies the additional semantic rules required by the GS1 General Specifications:

  • The SSCC must not be all zeros.
  • The GS1 company prefix — which begins at digit 2 (index 1), immediately after the single-digit extension digit — must match a recognised range in the GS1 prefix registry.

SSCC structure

  [ Extension digit (1) ][ GS1 Company Prefix (N) ][ Serial Reference ][ Check digit (1) ]
  |<----- 1 digit ----->||<-- starts at index 1 -------------------------------->||
  • Field Details

    • INSTANCE

      public static final SSCCValidator INSTANCE
      The singleton instance.
  • Constructor Details

    • SSCCValidator

      public SSCCValidator()
      Creates a new SSCCValidator.
  • Method Details

    • validate

      public List<GaiaError> validate(GS1AIObjectElement element, GaiaConstants.Language language)
      Description copied from interface: ContentInterface
      Validates the data value of element for semantic correctness and returns the resulting localized errors, or an empty list when valid.
      Specified by:
      validate in interface ContentInterface
      Parameters:
      element - the fully-parsed AI element; never null; GS1AIObjectElement.getValue() is guaranteed non-null and already free of standard errors when this method is called
      language - the language in which to produce the error messages
      Returns:
      one GaiaError per failing condition, in order; empty if valid