switch (readMode) {
case DEFAULT:
ois.defaultReadObject();
break;
case FIELD:
final GetField getField = ois.readFields();
final Object marker = new Object();
if (getField.defaulted("object1")) {
throw new IOException(MUST_NOT_BE_DEFAULTED);
}
object1 = getField.get("object1", marker);
if (object1 == marker) {// NOPMD
throw new IOException(MUST_NOT_BE_DEFAULT_VALUE);
}
if (getField.defaulted("object2")) {
throw new IOException(MUST_NOT_BE_DEFAULTED);
}
object2 = getField.get("object2", marker);
if (object2 == marker) {// NOPMD
throw new IOException(MUST_NOT_BE_DEFAULT_VALUE);
}
if (getField.defaulted("value")) {
throw new IOException(MUST_NOT_BE_DEFAULTED);
}
value = getField.get("value", 0);
if (getField.defaulted("notPrimitiveValue")) {
throw new IOException(MUST_NOT_BE_DEFAULTED);
}
notPrimitiveValue = (Integer) getField.get("notPrimitiveValue",
marker);
if (notPrimitiveValue == marker) {// NOPMD
throw new IOException(MUST_NOT_BE_DEFAULT_VALUE);
}