Exemplo n.º 1
0
  public void write(Object obj, MessagePartInfo part, Element output) {
    AegisType type = databinding.getType(part);

    if (type == null) {
      throw new Fault(new Message("NO_MESSAGE_FOR_PART", LOG));
    }

    Context context = new Context(databinding.getAegisContext());

    context.setAttachments(attachments);
    type = TypeUtil.getWriteType(databinding.getAegisContext(), obj, type);
    try {
      W3CDOMStreamWriter domWriter = new W3CDOMStreamWriter(output);
      ElementWriter writer = new ElementWriter(domWriter);
      MessageWriter w2 = writer.getElementWriter(part.getConcreteName());
      if (type.isNillable() && type.isWriteOuter() && obj == null) {
        w2.writeXsiNil();
        w2.close();
        return;
      }

      type.writeObject(obj, w2, context);
      w2.close();
    } catch (DatabindingException e) {
      throw new RuntimeException(e);
    }
  }
Exemplo n.º 2
0
 public XMLStreamDataReader(AegisDatabinding databinding, Bus bus) {
   this.databinding = databinding;
   reader = new AegisXMLStreamDataReader(databinding.getAegisContext());
 }