Enum GS1CharacterSet

java.lang.Object
java.lang.Enum<GS1CharacterSet>
tools.pantheum.gaia.gs1.charset.GS1CharacterSet
All Implemented Interfaces:
Serializable, Comparable<GS1CharacterSet>, java.lang.constant.Constable

public enum GS1CharacterSet extends Enum<GS1CharacterSet>
The GS1-defined character sets used to validate AI data.

Character counts and members follow GS1 General Specifications Table 7-11.

  • Enum Constant Details

    • NUMERIC

      public static final GS1CharacterSet NUMERIC
      Digits 0–9 only.
    • CSET39

      public static final GS1CharacterSet CSET39
      GS1 AI encodable character set 39. Digits 0–9, uppercase A–Z, and # - / (39 characters total).
    • CSET64

      public static final GS1CharacterSet CSET64
      GS1 AI encodable character set 64. Digits 0–9, upper- and lower-case letters, -, _, and = (64 characters total).
    • CSET82

      public static final GS1CharacterSet CSET82
      GS1 AI encodable character set 82. Digits, upper- and lower-case letters, and the 20 permitted special characters !"&'()*+,-./:;<=>?_% (82 characters total).
  • Method Details

    • values

      public static GS1CharacterSet[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static GS1CharacterSet valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • getChars

      public String getChars()
      Returns the complete string of characters permitted in this set.
      Returns:
      the chars.
    • contains

      public boolean contains(char c)
      Returns true if c is a member of this character set.
      Parameters:
      c - the c
      Returns:
      true if contains.
    • forComponentType

      public static GS1CharacterSet forComponentType(String type, String formatString)
      Maps an AI component type code and the AI-level format string to the appropriate GS1CharacterSet for character-level validation.

      For alphanumeric ("X") components the format string narrows the set:

      • "N" → NUMERIC
      • "X" + formatString contains "Z" → CSET64
      • "X" + formatString contains "Y" → CSET39
      • "X" otherwise → CSET82
      Parameters:
      type - the component type code ("N" or "X")
      formatString - the AI-level format string (e.g. "X..20"), may be null
      Returns:
      the character set to validate against, or null to skip charset checking