// appropriate editor type. The {@link #onSelect(String)} function
// instantiates the proper editor type for the key and binds the new
// editor to our editor.
for (String key : obj.keySet()) {
if (properties.containsKey(key)) {
SchemaEditor editor = onSelect(key, OPTIONAL_PROPERTY);
editor.setJSONValue(obj.get(key));
} else if (additionalPropertiesType != null){
SchemaEditor editor = addAdditionalPropertyEditor(key);
editor.setJSONValue(obj.get(key));
} else {
throw new JSONException("JSON object contains unknown key: " + key);
}
}
} else {