Class DecimalPointEnricher

java.lang.Object
tools.pantheum.gaia.gs1.interpretation.enricher.DecimalPointEnricher
All Implemented Interfaces:
InterpretationEnricherInterface

public final class DecimalPointEnricher extends Object implements InterpretationEnricherInterface
Enriches a 6-digit numeric measurement value with a human-readable decimal representation, using the last digit of the AI code as the number of implied decimal places.

Used by AIs in the following ranges:

  • 31nn — weights and measures (metric)
  • 32nn — lengths and dimensions (imperial/US)
  • 35nn — areas and weights (imperial/US)
  • 36nn — volumes (imperial/US)

The last digit of the 4-digit AI code defines the number of implied decimal places (0–5). For example, AI 3102 has 2 decimal places, so a raw value of "001234" is interpreted as "12.34".

Produced interpretations

  • DECIMAL_VALUE — the value formatted with the implied decimal point, e.g. "12.34" for raw "001234" at 2 decimal places, or "1234" at 0 decimal places.
  • DECIMAL_PLACES — the number of implied decimal places taken from the last digit of the AI code, e.g. "2" for AI 3102.
  • Constructor Details

  • Method Details

    • enrich

      public List<GS1AIInterpretation> enrich(String baseValue, AiDefinition aiDefinition, GS1AIObjectElement element)
      Description copied from interface: InterpretationEnricherInterface
      Produces additional interpretations from baseValue.
      Specified by:
      enrich in interface InterpretationEnricherInterface
      Parameters:
      baseValue - the extracted segment value (never null or empty)
      aiDefinition - the full AI definition for the element being interpreted
      element - the parent element, providing access to all component values and any interpretations already added in this pass
      Returns:
      additional interpretations to append; never null