final Map<String, ReadField> readFields = new HashMap<String, ReadField>();
for (SerializableField serializableField : sc.getFields()) {
final ReadField readField;
switch (serializableField.getKind()) {
case BOOLEAN: {
readField = new BooleanReadField(serializableField);
break;
}
case BYTE: {
readField = new ByteReadField(serializableField);
break;
}
case CHAR: {
readField = new CharReadField(serializableField);
break;
}
case DOUBLE: {
readField = new DoubleReadField(serializableField);
break;
}
case FLOAT: {
readField = new FloatReadField(serializableField);
break;
}
case INT: {
readField = new IntReadField(serializableField);
break;
}
case LONG: {
readField = new LongReadField(serializableField);
break;
}
case OBJECT: {
readField = new ObjectReadField(serializableField);
break;
}
case SHORT: {
readField = new ShortReadField(serializableField);
break;
}
default: {
continue;
}
}
readFields.put(serializableField.getName(), readField);
}
// read primitive fields
for (SerializableField serializableField : fields) {
final ReadField readField;
switch (serializableField.getKind()) {
case BOOLEAN: {
readField = new BooleanReadField(serializableField, serialUnmarshaller.readBoolean());
break;
}
case BYTE: {
readField = new ByteReadField(serializableField, serialUnmarshaller.readByte());
break;