Class DecimalPointEnricher
java.lang.Object
tools.pantheum.gaia.gs1.interpretation.enricher.DecimalPointEnricher
- All Implemented Interfaces:
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 AI3102.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionenrich(String baseValue, AiDefinition aiDefinition, GS1AIObjectElement element) Produces additional interpretations frombaseValue.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface InterpretationEnricherInterface
enrichModifier and TypeMethodDescriptiondefault List<GS1AIInterpretation> enrich(String baseValue, AiDefinition aiDefinition, GS1AIObjectElement element, ParseConfig config) Produces additional interpretations frombaseValue, applying caller-supplied formatting preferences fromconfig.
-
Constructor Details
-
DecimalPointEnricher
public DecimalPointEnricher()Creates a newDecimalPointEnricher.
-
-
Method Details
-
enrich
public List<GS1AIInterpretation> enrich(String baseValue, AiDefinition aiDefinition, GS1AIObjectElement element) Description copied from interface:InterpretationEnricherInterfaceProduces additional interpretations frombaseValue.- Specified by:
enrichin interfaceInterpretationEnricherInterface- Parameters:
baseValue- the extracted segment value (nevernullor empty)aiDefinition- the full AI definition for the element being interpretedelement- the parent element, providing access to all component values and any interpretations already added in this pass- Returns:
- additional interpretations to append; never
null
-