Example #1
0
 @Override
 public void marshal(
     final Object source,
     final HierarchicalStreamWriter writer,
     final MarshallingContext context) {
   TurnTest turnTest = (TurnTest) source;
   XMLTurn turn = turnTest.getTurn();
   writer.startNode("turn");
   context.convertAnother(turn);
   writer.endNode();
   AdministratorResponses ac = turnTest.getAdministrator();
   writer.startNode("administrator");
   context.convertAnother(ac);
   writer.endNode();
   PlayerActions pa = turnTest.getActions();
   writer.startNode("actions");
   context.convertAnother(pa);
   writer.endNode();
 }
Example #2
0
  @Override
  public Object unmarshal(
      final HierarchicalStreamReader reader, final UnmarshallingContext context) {
    TurnTest turnTest = new TurnTest();
    reader.moveDown();
    XMLTurn turn = (XMLTurn) context.convertAnother(turnTest, XMLTurn.class);
    turnTest.setTurn(turn);
    reader.moveUp();

    reader.moveDown();
    AdministratorResponses ac =
        (AdministratorResponses) context.convertAnother(turnTest, AdministratorResponses.class);
    turnTest.setAdministrator(ac);
    reader.moveUp();

    reader.moveDown();
    PlayerActions pa = (PlayerActions) context.convertAnother(turnTest, PlayerActions.class);
    turnTest.setActions(pa);
    reader.moveUp();
    return turnTest;
  }