Record Class SimpleMapping

java.lang.Object
java.lang.Record
org.openehealth.ipf.commons.map.SimpleMapping
Record Components:
name - mapping name, unique within a Mappings instance
keySystem - formal identifier (usually an OID or a URI) of the key code system, may be null
valueSystem - formal identifier of the value code system, may be null
entries - the key/value pairs, in declaration order
unmatched - what to answer when a key has no entry, never null
reverseUnmatched - what to answer when a value has no entry, never null
reversible - whether a reverse index is built at all. A one-directional mapping may legally map several keys onto the same value
override - whether this declaration is meant to replace a mapping of the same name loaded earlier. Without it, a duplicate name is a load-time error
All Implemented Interfaces:
Mapping

public record SimpleMapping(String name, String keySystem, String valueSystem, List<Entry> entries, Unmatched unmatched, Unmatched reverseUnmatched, boolean reversible, boolean override) extends Record implements Mapping
A translation table: entries of its own, the identifiers of the two code systems involved, and the fallback behavior for either direction. This is what every MappingLoader reads a table in its format into, and what every MappingWriter writes.
Since:
6.0
  • Constructor Details

    • SimpleMapping

      public SimpleMapping(String name, String keySystem, String valueSystem, List<Entry> entries, Unmatched unmatched, Unmatched reverseUnmatched, boolean reversible, boolean override)
      Creates an instance of a SimpleMapping record class.
      Parameters:
      name - the value for the name record component
      keySystem - the value for the keySystem record component
      valueSystem - the value for the valueSystem record component
      entries - the value for the entries record component
      unmatched - the value for the unmatched record component
      reverseUnmatched - the value for the reverseUnmatched record component
      reversible - the value for the reversible record component
      override - the value for the override record component
  • Method Details

    • parts

      public List<String> parts()
      Specified by:
      parts in interface Mapping
      Returns:
      no parts: a simple mapping answers from its own entries
    • builder

      public static SimpleMapping.Builder builder(String name)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Specified by:
      name in interface Mapping
      Returns:
      the value of the name record component
    • keySystem

      public String keySystem()
      Returns the value of the keySystem record component.
      Specified by:
      keySystem in interface Mapping
      Returns:
      the value of the keySystem record component
    • valueSystem

      public String valueSystem()
      Returns the value of the valueSystem record component.
      Specified by:
      valueSystem in interface Mapping
      Returns:
      the value of the valueSystem record component
    • entries

      public List<Entry> entries()
      Returns the value of the entries record component.
      Specified by:
      entries in interface Mapping
      Returns:
      the value of the entries record component
    • unmatched

      public Unmatched unmatched()
      Returns the value of the unmatched record component.
      Specified by:
      unmatched in interface Mapping
      Returns:
      the value of the unmatched record component
    • reverseUnmatched

      public Unmatched reverseUnmatched()
      Returns the value of the reverseUnmatched record component.
      Specified by:
      reverseUnmatched in interface Mapping
      Returns:
      the value of the reverseUnmatched record component
    • reversible

      public boolean reversible()
      Returns the value of the reversible record component.
      Specified by:
      reversible in interface Mapping
      Returns:
      the value of the reversible record component
    • override

      public boolean override()
      Returns the value of the override record component.
      Specified by:
      override in interface Mapping
      Returns:
      the value of the override record component