private static String encodePrimitive(Primitive p, EncodingCharacters encodingChars) { String val = ((Primitive) p).getValue(); if (val == null) { val = ""; } else { val = Escape.escape(val, encodingChars); } return val; }
/** * Fills a field with values from an unparsed string representing the field. * @param destinationField the field Type * @param data the field string (including all components and subcomponents; not including field delimiters) * @param encodingCharacters the encoding characters used in the message */ public void parse(Type destinationField, String data, EncodingCharacters encodingCharacters) throws HL7Exception { String[] components = split(data, String.valueOf(encodingCharacters.getComponentSeparator())); for (int i = 0; i < components.length; i++) { String[] subcomponents = split(components[i], String.valueOf(encodingCharacters.getSubcomponentSeparator())); for (int j = 0; j < subcomponents.length; j++) { String val = subcomponents[j]; if (val != null) { val = Escape.unescape(val, encodingCharacters); } Terser.getPrimitive(destinationField, i+1, j+1).setValue(val); } } }
/** * Fills a field with values from an unparsed string representing the field. * @param destinationField the field Type * @param data the field string (including all components and subcomponents; not including field delimiters) * @param encodingCharacters the encoding characters used in the message */ public void parse(Type destinationField, String data, EncodingCharacters encodingCharacters) throws HL7Exception { String[] components = split(data, String.valueOf(encodingCharacters.getComponentSeparator())); for (int i = 0; i < components.length; i++) { String[] subcomponents = split(components[i], String.valueOf(encodingCharacters.getSubcomponentSeparator())); for (int j = 0; j < subcomponents.length; j++) { String val = subcomponents[j]; if (val != null) { val = Escape.unescape(val, encodingCharacters); } Terser.getPrimitive(destinationField, i+1, j+1).setValue(val); } } }
fieldText = Escape.unescape(fieldText, encodingChars); result.append(fieldText); if (j < reps.length - 1)
private static String encodePrimitive(Primitive p, EncodingCharacters encodingChars) { String val = ((Primitive) p).getValue(); if (val == null) { val = ""; } else { val = Escape.escape(val, encodingChars); } return val; }
fieldText = Escape.unescape(fieldText, encodingChars); result.append(fieldText); if (j < reps.length - 1)