OptionalPropertyMode opm = getOptionalPropertyMode();
if(prop.isCollection()) {
CollectionTypeAttribute ct = getCollectionType();
r = ct.get(getBuilder().model);
} else {
FieldRendererFactory frf = getBuilder().fieldRendererFactory;
if(prop.isOptionalPrimitive()) {
// the property type can be primitive type if we are to ignore absence
switch(opm) {
case PRIMITIVE:
r = frf.getRequiredUnboxed();
break;
case WRAPPER:
// force the wrapper type
r = frf.getSingle();
break;
case ISSET:
r = frf.getSinglePrimitiveAccess();
break;
default:
throw new Error();
}
} else {
r = frf.getDefault();
}
}
if(opm==OptionalPropertyMode.ISSET) {
// only isSet is allowed on a collection. these 3 modes aren't really symmetric.