Exemplo n.º 1
0
 /**
  * Creates a copy of the internal list of parameters. The list items are represented as <code>
  * byte[]</code> used in <source>source.writeID(...)</code>.
  *
  * @return List of <code>byte[]</code>
  * @throws TextCommandParserException If list contains a parameter with wrong type.
  * @throws JAXBException If list contains a parameter with wrong type.
  */
 public List toHexStringListType() throws TextCommandParserException {
   try {
     List hexList = new ArrayList(size());
     Iterator it = iterator();
     while (it.hasNext()) {
       ValueParameter p = (ValueParameter) it.next();
       byte[] hexArray = HexUtil.hexToByteArray(p.getStringValue());
       hexList.add(hexArray);
     }
     return hexList;
   } catch (ClassCastException e) {
     throw new TextCommandParserException("Parameter in the list has wrong type.");
   }
 }
Exemplo n.º 2
0
 /**
  * Creates a copy of the internal list of parameters. The list items are represented as <code>
  * TagFieldValueParamType</code> used in <source>source.write(...)</code>.
  *
  * @return List of <code>TagFieldValueParamType</code>
  * @throws TextCommandParserException If list contains a parameter with wrong type.
  * @throws JAXBException If list contains a parameter with wrong type.
  * @see org.fosstrak.reader.rprm.core.msg.command.TagFieldValueParamType
  */
 public List toTagFieldValueList() throws TextCommandParserException, JAXBException {
   try {
     List tfvList = new ArrayList(size());
     Iterator it = iterator();
     while (it.hasNext()) {
       PairParameter p = (PairParameter) it.next();
       TagFieldValueParamType tfvParam =
           TextCommandParserHelper.cmdFactory.createTagFieldValueParamType();
       tfvParam.setTagFieldName(p.getField());
       tfvParam.setTagFieldValue(HexUtil.hexToByteArray(p.getValue()));
       tfvList.add(tfvParam);
     }
     return tfvList;
   } catch (ClassCastException e) {
     throw new TextCommandParserException("Parameter in the list has wrong type.");
   }
 }