Class AICharacterSetChecker
java.lang.Object
tools.pantheum.gaia.gs1.syntax.ai.AICharacterSetChecker
Validates characters in GS1 element strings against GS1-defined character sets.
Used as a pre-flight check on the entire raw input before tokenising — see
checkInput(String, ParseConfig) — and can also validate individual AI values
against a specific GS1CharacterSet via
check(String, GS1CharacterSet, int, ParseConfig).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncheck(String value, GS1CharacterSet charSet, int basePosition, ParseConfig config) Validates every character invalueagainst the givenGS1CharacterSet.checkInput(String input, ParseConfig config) Pre-flight check on the entire raw input string.
-
Constructor Details
-
AICharacterSetChecker
public AICharacterSetChecker()Creates a newAICharacterSetChecker.
-
-
Method Details
-
checkInput
Pre-flight check on the entire raw input string.Every character must belong to at least one of
GS1CharacterSet.CSET39,GS1CharacterSet.CSET64, orGS1CharacterSet.CSET82, or be the FNC1 group separator (ASCII 0x1D). OneGE-S008error is produced per invalid character.- Parameters:
input- the raw element string to validateconfig- parse configuration — controls the language of error messages- Returns:
- list of errors; empty when all characters are valid
-
check
public List<GaiaError> check(String value, GS1CharacterSet charSet, int basePosition, ParseConfig config) Validates every character invalueagainst the givenGS1CharacterSet. The FNC1 group separator is always permitted. OneGE-S008error is produced per invalid character, with positions offset bybasePosition.- Parameters:
value- the string slice to validatecharSet- the character set to validate againstbasePosition- position of the first character in the original input (for error reporting)config- parse configuration — controls the language of error messages- Returns:
- list of errors; empty when all characters are valid
-