Interface InterpretationEnricherInterface

All Known Implementing Classes:
AIDCMediaTypeEnricher, AquaticSpeciesEnricher, BirthSequenceEnricher, CertificationReferenceEnricher, CpidEnricher, DateEnricher, DateTimeEnricher, DecimalAmountEnricher, DecimalPercentageEnricher, DecimalPointEnricher, EidEnricher, GeoCoordinateEnricher, GMNEnricher, GS1PrefixEnricher, GTINEnricher, HarvestDateEnricher, HIDRIEnricher, IBANEnricher, IccidEnricher, ImeiEnricher, Iso3166Alpha2Enricher, Iso3166Enricher, Iso3166ListEnricher, Iso4217Enricher, Iso5218Enricher, ISOUnitEnricher, ItipEnricher, MonetaryAmountEnricher, NsnEnricher, PcEncEnricher, PieceOfTotalEnricher, ProductionMethodEnricher, ProductionTimeEnricher, RollDimensionsEnricher, SSCCEnricher, TemperatureCelsiusEnricher, TemperatureFahrenheitEnricher, TimeEnricher, UicEnricher, YesNoEnricher

public interface InterpretationEnricherInterface
Enriches a base value extracted from a GS1 AI element with additional GS1AIInterpretation objects derived via a registry lookup or other logic.

Contract

  • Implementations must be stateless and thread-safe.
  • The returned list must never be null; return an empty list when no enrichment is possible (e.g. lookup found no match).
  • Enricher output is always additive — it is appended to any base GS1AIInterpretation already produced by the definition's type/label. Enrichers must not attempt to replace or remove existing interpretations.

Registration

Enricher implementations live in the tools.pantheum.gaia.gs1.interpretation.enricher sub-package and are referenced by their simple class name in ai-content.json. They are instantiated once via reflection by InterpretationRegistry and cached for the lifetime of the registry.
  • Method Details

    • enrich

      List<GS1AIInterpretation> enrich(String baseValue, AiDefinition aiDefinition, GS1AIObjectElement element)
      Produces additional interpretations from baseValue.
      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
    • enrich

      default List<GS1AIInterpretation> enrich(String baseValue, AiDefinition aiDefinition, GS1AIObjectElement element, ParseConfig config)
      Produces additional interpretations from baseValue, applying caller-supplied formatting preferences from config.

      Enrichers that do not use config inherit this default, which delegates to enrich(String, AiDefinition, GS1AIObjectElement). Enrichers that format dates (e.g. DateEnricher, ProductionTimeEnricher) override this method.

      Parameters:
      baseValue - the extracted segment value (never null or empty)
      aiDefinition - the full AI definition for the element being interpreted
      element - the parent element
      config - caller-supplied parse configuration; never null
      Returns:
      additional interpretations to append; never null