Record Class CompositeMapping
java.lang.Object
java.lang.Record
org.openehealth.ipf.commons.map.CompositeMapping
- Record Components:
name- mapping name, unique within aMappingsinstancekeySystem- formal identifier of the key code system, may benullvalueSystem- formal identifier of the value code system, may benullparts- the names of the mappings asked, in order; never emptyoverride- whether this declaration is meant to replace a mapping of the same name loaded earlier
- All Implemented Interfaces:
Mapping
public record CompositeMapping(String name, String keySystem, String valueSystem, List<String> parts, boolean override)
extends Record
implements Mapping
A mapping that holds no entries of its own but the names of other mappings - its parts - and
answers through them. It exists for sources that spread one translation over several tables,
the common case being a FHIR ConceptMap whose groups translate one source code system into
several target systems. Each group is a
SimpleMapping; the composite over them lets a
caller ask the ConceptMap as a whole without knowing which groups it has or which one holds a
code.
A lookup asks the parts in declaration order, in two rounds:
- the first part that declares an entry for the key answers;
- only if no part does, the first part whose fallback answers.
$translate reads all groups of a
ConceptMap when no target system is given. Reverse lookups work the same way.
Since the parts may translate into different code systems, a plain lookup cannot say which
system an answer belongs to; Mappings.translate(String, String) returns it along with
the code, taken from the part that answered. The composite's own keySystem() and
valueSystem() are whatever its creator declares; the ConceptMap loader sets those that its
parts share, and null where they differ.
The parts must be simple mappings registered before the composite, so composites do not nest.
No file format declares one - loaders create them - and no MappingWriter writes one:
its parts are written instead.
- Since:
- 6.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classMutable helper forMappingLoaderimplementations, which assemble a composite while walking their source document. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CompositeMapping.Builderentries()final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thekeySystemrecord component.name()Returns the value of thenamerecord component.booleanoverride()Returns the value of theoverriderecord component.parts()Returns the value of thepartsrecord component.booleanfinal StringtoString()Returns a string representation of this record class.Returns the value of thevalueSystemrecord component.
-
Constructor Details
-
CompositeMapping
public CompositeMapping(String name, String keySystem, String valueSystem, List<String> parts, boolean override) Creates an instance of aCompositeMappingrecord class.- Parameters:
name- the value for thenamerecord componentkeySystem- the value for thekeySystemrecord componentvalueSystem- the value for thevalueSystemrecord componentparts- the value for thepartsrecord componentoverride- the value for theoverriderecord component
-
-
Method Details
-
entries
-
unmatched
-
reverseUnmatched
- Specified by:
reverseUnmatchedin interfaceMapping- Returns:
- what to answer when a value has no entry
-
reversible
public boolean reversible()- Specified by:
reversiblein interfaceMapping- Returns:
- whether a reverse index is built at all
-
builder
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
name
-
keySystem
-
valueSystem
Returns the value of thevalueSystemrecord component.- Specified by:
valueSystemin interfaceMapping- Returns:
- the value of the
valueSystemrecord component
-
parts
-
override
-