Esempio n. 1
0
 /**
  * Nillable is only allowed if the actual property is Nullable
  *
  * @param name
  * @return
  */
 public boolean isNillable(QName name) {
   AegisType type = getType(name);
   if (!type.isNillable()) {
     return false;
   }
   return nillable;
 }
Esempio n. 2
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);
    }
  }