Record Class Entry

java.lang.Object
java.lang.Record
org.openehealth.ipf.commons.map.Entry
Record Components:
key - left side of the mapping, may be null for a mapping that answers an absent input
value - right side of the mapping
equivalence - correspondence between key and value, never null — defaults to Equivalence.EQUAL
keyDisplay - human-readable name of the key in its code system, or null
valueDisplay - human-readable name of the value in its code system, or null

public record Entry(String key, String value, Equivalence equivalence, String keyDisplay, String valueDisplay) extends Record
A single key/value-pair of a Mapping, qualified by the Equivalence that holds between the two, and optionally by the human-readable name of either side.

The two displays are informative: nothing looks a code up by its display, and no format requires them. They exist so that a mapping read from a source that carries them - a FHIR ConceptMap does, for both the source and the target code - keeps them. A caller building a Coding from a translation has one to put in it.

Both key and value are Strings.

Since:
6.0
  • Constructor Details

    • Entry

      public Entry(String key, String value, Equivalence equivalence, String keyDisplay, String valueDisplay)
      Creates an instance of a Entry record class.
      Parameters:
      key - the value for the key record component
      value - the value for the value record component
      equivalence - the value for the equivalence record component
      keyDisplay - the value for the keyDisplay record component
      valueDisplay - the value for the valueDisplay record component
    • Entry

      public Entry(String key, String value)
    • Entry

      public Entry(String key, String value, Equivalence equivalence)
  • Method Details

    • isInvertible

      public boolean isInvertible()
      Returns:
      whether this entry may contribute to the reverse index of its mapping
    • isTranslation

      public boolean isTranslation()
      Returns:
      whether looking this entry's key up answers with its value
      See Also:
    • withDisplays

      public Entry withDisplays(String keyDisplay, String valueDisplay)
      Returns:
      a copy of this entry carrying the given displays
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • key

      public String key()
      Returns the value of the key record component.
      Returns:
      the value of the key record component
    • value

      public String value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component
    • equivalence

      public Equivalence equivalence()
      Returns the value of the equivalence record component.
      Returns:
      the value of the equivalence record component
    • keyDisplay

      public String keyDisplay()
      Returns the value of the keyDisplay record component.
      Returns:
      the value of the keyDisplay record component
    • valueDisplay

      public String valueDisplay()
      Returns the value of the valueDisplay record component.
      Returns:
      the value of the valueDisplay record component