writer.endNode();
}
}
public void writeFieldsToStream(Map fields) {
ObjectStreamClass objectStreamClass = ObjectStreamClass.lookup(currentType[0]);
writer.startNode(ELEMENT_DEFAULT);
for (Iterator iterator = fields.keySet().iterator(); iterator.hasNext();) {
String name = (String) iterator.next();
ObjectStreamField field = objectStreamClass.getField(name);
Object value = fields.get(name);
if (field == null) {
throw new ObjectAccessException("Class " + value.getClass().getName()
+ " may not write a field named '" + name + "'");
}
if (value != null) {
writer.startNode(mapper.serializedMember(currentType[0], name));
if (field.getType() != value.getClass() && !field.getType().isPrimitive()) {
writer.addAttribute(ATTRIBUTE_CLASS, mapper.serializedClass(value.getClass()));
}
context.convertAnother(value);
writer.endNode();
}
}
writer.endNode();
}
public void defaultWriteObject() {
boolean writtenDefaultFields = false;
ObjectStreamClass objectStreamClass = ObjectStreamClass.lookup(currentType[0]);
if (objectStreamClass == null) {
return;
}
ObjectStreamField[] fields = objectStreamClass.getFields();
for (int i = 0; i < fields.length; i++) {
ObjectStreamField field = fields[i];
Object value = readField(field, currentType[0], source);
if (value != null) {
if (!writtenClassWrapper[0]) {