ReflectionEntry e = entries[i];
if(!e.isAvailable()) {
continue;
}
MessagePackObject obj = array[i];
if(obj.isNil()) {
if(e.isRequired()) {
// Required + nil => exception
throw new MessageTypeException();
} else if(e.isOptional()) {
// Optional + nil => keep default value
} else { // Nullable
// Nullable + nil => set null
e.setNull(to);
//e.set(to,null);
}
} else {
e.convert(to, obj);
//e.set(to, from.convert(e.getType()));
}
}
int max = length < entries.length ? length : entries.length;
for(; i < max; i++) {
ReflectionEntry e = entries[i];
if(!e.isAvailable()) {
continue;
}
MessagePackObject obj = array[i];
if(obj.isNil()) {
// this is Optional field becaue i >= minimumArrayLength
// Optional + nil => keep default value
} else {
e.convert(to, obj);
//e.set(to, obj.convert(e.getType()));