Exemplo n.º 1
0
 /**
  * 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
     }
 }
Exemplo n.º 2
0
 /**
  * Check if a field indicated by a fpath is present
  *
  * @param fpath dot-separated field path (i.e. 63.2)
  */
 public boolean hasField(String fpath) throws ISOException {
   StringTokenizer st = new StringTokenizer(fpath, ".");
   ISOMsg m = this;
   for (; ; ) {
     int fldno = Integer.parseInt(st.nextToken());
     if (st.hasMoreTokens()) {
       Object obj = m.getValue(fldno);
       if (obj instanceof ISOMsg) {
         m = (ISOMsg) obj;
       } else {
         // No real way of checking for further subfields, return false, perhaps should be
         // ISOException?
         return false;
       }
     } else {
       return m.hasField(fldno);
     }
   }
 }