/** * add all fields present on received parameter to this ISOMsg<br> * please note that received fields take precedence over existing ones (simplifying card agent * message creation and template handling) * * @param m ISOMsg to merge */ public void merge(ISOMsg m) { for (int i = 0; i <= m.getMaxField(); i++) try { if (m.hasField(i)) set(m.getComponent(i)); } catch (ISOException e) { // should never happen } }
/** * get the component associated with the given field number * * @param fpath field path * @return the Component */ public ISOComponent getComponent(String fpath) throws ISOException { StringTokenizer st = new StringTokenizer(fpath, "."); ISOMsg m = this; ISOComponent obj = null; for (; ; ) { int fldno = Integer.parseInt(st.nextToken()); obj = m.getComponent(fldno); if (st.hasMoreTokens()) { if (obj instanceof ISOMsg) { m = (ISOMsg) obj; } else break; // 'Quick' exit if hierachy is not present. } else break; } return obj; }