Class SSCCValidator
java.lang.Object
tools.pantheum.gaia.gs1.content.validator.SSCCValidator
- All Implemented Interfaces:
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvalidate(GS1AIObjectElement element, GaiaConstants.Language language) Validates the data value ofelementfor semantic correctness and returns the resulting localized errors, or an empty list when valid.
-
Field Details
-
INSTANCE
The singleton instance.
-
-
Constructor Details
-
SSCCValidator
public SSCCValidator()Creates a newSSCCValidator.
-
-
Method Details
-
validate
Description copied from interface:ContentInterfaceValidates the data value ofelementfor semantic correctness and returns the resulting localized errors, or an empty list when valid.- Specified by:
validatein interfaceContentInterface- Parameters:
element- the fully-parsed AI element; nevernull;GS1AIObjectElement.getValue()is guaranteed non-null and already free of standard errors when this method is calledlanguage- the language in which to produce the error messages- Returns:
- one
GaiaErrorper failing condition, in order; empty if valid
-