Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* (C) Copyright IBM Corp. 2020, 2021
*
* SPDX-License-Identifier: Apache-2.0
*/
package io.github.linuxforhealth.hl7.data;
import java.util.Collection;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ca.uhn.hl7v2.model.Composite;
import ca.uhn.hl7v2.model.DataTypeException;
import ca.uhn.hl7v2.model.Primitive;
import ca.uhn.hl7v2.model.Type;
import ca.uhn.hl7v2.model.Variable;
import ca.uhn.hl7v2.model.primitive.ID;
import ca.uhn.hl7v2.model.primitive.IS;
import ca.uhn.hl7v2.model.v26.datatype.CWE;
import ca.uhn.hl7v2.model.v26.datatype.ST;
public class Hl7DataHandlerUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(Hl7DataHandlerUtil.class);
private Hl7DataHandlerUtil() {
}
public static String getStringValue(Object obj) {
return getStringValue(obj, false);
}
public static String getStringValue(Object obj, boolean allComponents) {
return getStringValue(obj, allComponents, ". ", true, true);
}
/**
* @param obj - object to return the string value of
* @param allComponents - should all components be handled in same call?
* @param separatorString - string to insert between items when obj is a list
* @param trim - whether to trim (whitespace) from the result
* @param separatorAtEnd - whether to add the separatorString after the final element when obj parm is a list
* @return The string value
*/
public static String getStringValue(Object obj, boolean allComponents, String separatorString, boolean trim,
boolean separatorAtEnd) {
if (obj == null) {
return null;
}
Object local = obj;
String returnValue;
if (local instanceof Collection) {
List