Class AICharacterSetChecker

java.lang.Object
tools.pantheum.gaia.gs1.syntax.ai.AICharacterSetChecker

public final class AICharacterSetChecker extends Object
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 Details

  • Method Details

    • checkInput

      public List<GaiaError> checkInput(String input, ParseConfig config)
      Pre-flight check on the entire raw input string.

      Every character must belong to at least one of GS1CharacterSet.CSET39, GS1CharacterSet.CSET64, or GS1CharacterSet.CSET82, or be the FNC1 group separator (ASCII 0x1D). One GE-S008 error is produced per invalid character.

      Parameters:
      input - the raw element string to validate
      config - 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 in value against the given GS1CharacterSet. The FNC1 group separator is always permitted. One GE-S008 error is produced per invalid character, with positions offset by basePosition.
      Parameters:
      value - the string slice to validate
      charSet - the character set to validate against
      basePosition - 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