io.github.linuxforhealth.hl7.parsing.result.Hl7ParsingStructureResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hl7v2-fhir-converter Show documentation
Show all versions of hl7v2-fhir-converter Show documentation
FHIR converter is a Java based library that enables converting Hl7v2 messages to FHIR resources
/*
* (C) Copyright IBM Corp. 2020
*
* SPDX-License-Identifier: Apache-2.0
*/
package io.github.linuxforhealth.hl7.parsing.result;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import ca.uhn.hl7v2.model.Structure;
/**
* Represents the result of parsing HL7 message.
*
*
* @author {user}
*/
public class Hl7ParsingStructureResult implements ParsingResult {
private List values;
public Hl7ParsingStructureResult(List values) {
this.values = new ArrayList<>();
if (values != null) {
values.removeIf(Objects::isNull);
this.values.addAll(values);
}
}
public Hl7ParsingStructureResult(Structure value) {
this.values = new ArrayList<>();
if (value != null) {
this.values.add(value);
}
}
public boolean isEmpty() {
return this.values.isEmpty();
}
@Override
public Structure getValue() {
if (!this.values.isEmpty()) {
return this.values.get(0);
}
return null;
}
@Override
public List getValues() {
return new ArrayList<>(this.values);
}
}