/** * Create an accessor for each field */ public NM getShoeSize() throws HL7Exception { return (NM) super.getField(1, 0); // 1=field num(numbered from 1) 0=repetition(numbered from 0) }
/** * Create an accessor for each field */ public ST[] getPetName() throws HL7Exception { return (ST[]) super.getField(1); // 1 - field num( numbered from 1) }
/** * Returns a specific repetition of field with concrete type at the specified index */ protected <T extends Type> T getTypedField(int number, int rep) { try { @SuppressWarnings("unchecked") T retVal = (T)getField(number, rep); return retVal; } 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 a specific repetition of field with concrete type at the specified index */ protected <T extends Type> T getTypedField(int number, int rep) { try { @SuppressWarnings("unchecked") T retVal = (T)getField(number, rep); return retVal; } 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); } }
/** * @see ca.uhn.hl7v2.model.Segment#isEmpty() */ public boolean isEmpty() throws HL7Exception { for (int i = 1; i <= numFields(); i++) { Type[] types = getField(i); for (Type type : types) { if (!type.isEmpty()) return false; } } return true; }
/** * @see ca.uhn.hl7v2.model.Segment#isEmpty() */ public boolean isEmpty() throws HL7Exception { for (int i = 1; i <= numFields(); i++) { Type[] types = getField(i); for (Type type : types) { if (!type.isEmpty()) return false; } } return true; }
/** * Iterates over the contained fields and calls the visitor for each * of them. * * @param visitor MessageVisitor instance to be called back. * @param location location of the group * @return true if visiting shall continue, false if not * @throws HL7Exception */ public boolean accept(MessageVisitor visitor, Location location) throws HL7Exception { if (visitor.start(this, location)) { String[] names = getNames(); for (int i = 1; i <= names.length; i++) { Field f = new Field(getField(i), getMaxCardinality(i)); Location nextLocation = f.provideLocation(location, i, -1); if (!f.accept(visitor, nextLocation)) break; } } return visitor.end(this, location); }
/** * Iterates over the contained fields and calls the visitor for each * of them. * * @param visitor MessageVisitor instance to be called back. * @param location location of the group * @return true if visiting shall continue, false if not * @throws HL7Exception */ public boolean accept(MessageVisitor visitor, Location location) throws HL7Exception { if (visitor.start(this, location)) { String[] names = getNames(); for (int i = 1; i <= names.length; i++) { Field f = new Field(getField(i), getMaxCardinality(i)); Location nextLocation = f.provideLocation(location, i, -1); if (!f.accept(visitor, nextLocation)) break; } } return visitor.end(this, location); }