Пример #1
0
 @Override
 public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
   FIXMLRoot root = (FIXMLRoot) source;
   writer.addAttribute("v", root.getVersion());
   writer.addAttribute("r", root.getReleaseDate());
   writer.addAttribute("s", root.getSchemaDate());
   context.convertAnother(root.getMessage());
 }
Пример #2
0
  public Message toFIX(String fixml) {
    if (!initialized) {
      initialize();
    }

    FIXMLRoot root = (FIXMLRoot) xstream.fromXML(fixml);
    return root.getMessage();
  }
Пример #3
0
  @Override
  public FIXMLRoot unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {

    FIXMLRoot root = new FIXMLRoot();
    root.setVersion(reader.getAttribute("v"));
    root.setReleaseDate(reader.getAttribute("r"));
    root.setSchemaDate(reader.getAttribute("s"));

    if (reader.hasMoreChildren()) {
      reader.moveDown();
      root.setMessage((Message) context.convertAnother(root, Message.class));
      reader.moveUp();
    }

    return root;
  }