Class WindingValidator

java.lang.Object
tools.pantheum.gaia.gs1.content.componentformat.WindingValidator
All Implemented Interfaces:
ComponentFormatInterface

public final class WindingValidator extends Object implements ComponentFormatInterface
Validates winding — the winding direction of a reel in AI 8001 (DIMENSIONS).

Permitted values per GS1 General Specifications section 3.9.1:

  • 0 — face out
  • 1 — face in
  • 9 — undefined
  • Field Details

    • INSTANCE

      public static final WindingValidator INSTANCE
      The singleton instance.
  • Method Details

    • validate

      public List<GaiaError> validate(String s, String ai, int position, String component, String format, GaiaConstants.Language language)
      Description copied from interface: ComponentFormatInterface
      Validates value against this format's rules and returns the resulting errors, or an empty list when valid (one GaiaError per failing condition).
      Specified by:
      validate in interface ComponentFormatInterface
      Parameters:
      s - the component slice to validate (charset already verified)
      ai - the Application Identifier of the enclosing element
      position - the character position of the element in the input
      component - the component's data title
      format - the component's format key
      language - the language in which to produce the error messages
      Returns:
      the validate.
    • nameForCode

      public static String nameForCode(String code)
      Returns the human-readable name for the given winding direction code, or null if the code is "9" (undefined) or unrecognised.
      Parameters:
      code - single-digit string: "0", "1", or "9"
      Returns:
      a new String