fmidev / fmi-avi-messageconverter-iwxxm

Conversion module for aviation IWXXM messages
MIT License
7 stars 5 forks source link

Split GenericAviationWeatherMessageScanner into IWXXM version- and message-specific scanners #88

Closed petringo closed 3 years ago

petringo commented 3 years ago

Split GenericAviationWeatherMessageScanner into IWXXM version- and message-specific scanners for better maintainability and cleaner responsibility of components.

Implementation suggestion:

  1. In GenericAviationWeatherMessageParser<T>:
    • Replace single scanner field with private Map<GenericAviationWeatherMessageParser.ScannerKey, GenericAviationWeatherMessageScanner> scanners.
    • ScannerKey would be a static inner value class with two properties: getNamespaceURI() and getDocumentElementName() being localName of document element. Carefully implement hashCode() (use Objects.hash()) and equals().
    • In convertMessage() method resolve the scanner responsible for message type and invoke it. Handle missing scanner / unknown message type gracefully.
  2. Refactor GenericAviationWeatherMessageScanner into an interface and create abstract AbstractGenericAviationWeatherMessageScanner base implementation.
  3. Create a scanner for each message type.
    • Suggested naming pattern: Generic<MESSAGE-TYPE>IWXXMScanner
    • Suggested package: fi.fmi.avi.converter.iwxxm.<IWXXM-VERSION>.<MESSAGE-TYPE>