Interface MappingWriter

All Known Implementing Classes:
ConceptMapWriter, XmlMappingWriter, YamlMappingWriter

public interface MappingWriter
Writes Mapping records as a mapping source document, the counterpart of MappingLoader.

Implementations are discovered with ServiceLoader and selected either by their format id or by the file extension they produce, which is what lets MappingConverter target whichever formats happen to be on the classpath. Register an implementation by listing it in META-INF/services/org.openehealth.ipf.commons.map.MappingWriter.

A writer is not required to round-trip everything a loader can read: a format that cannot express part of the model rejects it rather than dropping it silently.

Since:
6.0
  • Method Summary

    Modifier and Type
    Method
    Description
     
    Short, stable identifier of the format this writer produces, matching the format id of the loader that reads it back, e.g.
    void
    write(List<? extends Mapping> mappings, Writer out)
     
  • Method Details

    • format

      String format()
      Short, stable identifier of the format this writer produces, matching the format id of the loader that reads it back, e.g. xml, yaml or conceptmap-r4-json. Compared case-insensitively, and unique among the writers on one classpath.
      Returns:
      the format id, never null or blank
    • extension

      String extension()
      Returns:
      the file extension of the format this writer produces, including the leading dot and lower case, e.g. .mapping.xml
    • write

      void write(List<? extends Mapping> mappings, Writer out)
      Parameters:
      mappings - the mappings to write
      out - the destination; the caller closes it