Пример #1
0
  public Object clone() {
    try {
      ISOMsg m = (ISOMsg) super.clone();
      m.fields = (TreeMap) ((TreeMap) fields).clone();
      if (header != null) m.header = (ISOHeader) header.clone();

      Iterator iter = fields.keySet().iterator();
      while (iter.hasNext()) {
        Integer k = (Integer) iter.next();
        ISOComponent c = (ISOComponent) m.fields.get(k);
        if (c instanceof ISOMsg) m.fields.put(k, ((ISOMsg) c).clone());
      }
      return m;
    } catch (CloneNotSupportedException e) {
      throw new InternalError();
    }
  }
Пример #2
0
 /**
  * Partially clone an ISOMsg
  *
  * @param fields int array of fields to go
  * @return new ISOMsg instance
  */
 public Object clone(int[] fields) {
   try {
     ISOMsg m = (ISOMsg) super.clone();
     m.fields = new TreeMap();
     for (int i = 0; i < fields.length; i++) {
       if (hasField(fields[i])) {
         try {
           m.set(getComponent(fields[i]));
         } catch (ISOException e) {
           // it should never happen
         }
       }
     }
     return m;
   } catch (CloneNotSupportedException e) {
     throw new InternalError();
   }
 }