/** * Returns an array of Field objects at the specified location in the * segment. In the case of non-repeating fields the array will be of length * one. Fields are numbered from 1. */ public Type[] getField(int number) throws HL7Exception { List<Type> retVal = getFieldAsList(number); return retVal.toArray(new Type[retVal.size()]); // note: fields are // numbered from 1 from // the user's // perspective }
/** * Returns an array of Field objects at the specified location in the * segment. In the case of non-repeating fields the array will be of length * one. Fields are numbered from 1. */ public Type[] getField(int number) throws HL7Exception { List<Type> retVal = getFieldAsList(number); return retVal.toArray(new Type[retVal.size()]); // note: fields are // numbered from 1 from // the user's // perspective }
protected int getReps(int number) { try { return getFieldAsList(number).size(); } catch (HL7Exception he) { log.error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } }
protected int getReps(int number) { try { return getFieldAsList(number).size(); } catch (HL7Exception he) { log.error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } }
/** * Returns an array of a specific type class */ protected <T extends Type> T[] getTypedField(int number, T[] array) { try { List<Type> retVal = getFieldAsList(number); @SuppressWarnings("unchecked") List<T> cast = (List<T>) retVal; return cast.toArray(array); } catch (ClassCastException cce) { log.error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { log.error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } }
/** * Returns an array of a specific type class */ protected <T extends Type> T[] getTypedField(int number, T[] array) { try { List<Type> retVal = getFieldAsList(number); @SuppressWarnings("unchecked") List<T> cast = (List<T>) retVal; return cast.toArray(array); } catch (ClassCastException cce) { log.error("Unexpected problem obtaining field value. This is a bug.", cce); throw new RuntimeException(cce); } catch (HL7Exception he) { log.error("Unexpected problem obtaining field value. This is a bug.", he); throw new RuntimeException(he); } }