fields.add(checkNotNull(field));
}
@Override
public final XMLPacket getXML() {
final XMLBuilder builder = XMLBuilder.create("x", XmppNamespaces.DATA).attribute("type", type.toString());
if (!Strings.isNullOrEmpty(title)) {
builder.childText("title", title);
}
for (final String instruction : instructions) {
builder.child("instructions").text(instruction);
}
if (reported != null) {
reported.build(builder);
}
for (final Item item : items) {
item.build(builder);
}
for (final Field field : fields) {
field.build(builder);
}
return builder.getXML();
}