Logger.getLogger(JSONDocumentMarshaler.class.getName()).log(Level.SEVERE, null, ex);
throw new JSONMarshalerException("illegalAccess");
}
ReflectType type = ReflectType.inspectObjectType(objectClass);
Inspection inspection = ReflectType.getInspection(objectClass);
boolean hasCollector = inspection.hasCollectors();
Map<CharSequence, Value> collector = null;
Map<CharSequence, Value> innerObjectCollector = null;
List<Value> innerArrayCollector = null;
if (hasCollector) {
collector = new HashMap<CharSequence, Value>();
}
if (inspection.hasInnerMap()) {
innerObjectCollector = new HashMap<CharSequence, Value>();
}
if (inspection.hasInnerList()) {
innerArrayCollector = new ArrayList<Value>();
}
for (Entry<CharSequence, Value> documentPropertyEntry : jsonObject.entrySet()) {
CharSequence key = documentPropertyEntry.getKey();
if (inspection.hasProperty(key.toString())) {
ClassProperty inspectorProperty = inspection.getProperty(key.toString());
Value documentValue = documentPropertyEntry.getValue();
try {
marshalJSONValue(documentValue, object, inspectorProperty);
} catch (IllegalAccessException ex) {
Logger.getLogger(JSONDocumentMarshaler.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalArgumentException ex) {
Logger.getLogger(JSONDocumentMarshaler.class.getName()).log(Level.SEVERE, null, ex);
} catch (InvocationTargetException ex) {
Logger.getLogger(JSONDocumentMarshaler.class.getName()).log(Level.SEVERE, null, ex);
}
} else {
if (hasCollector) {
collector.put(key, documentPropertyEntry.getValue());
}
if (inspection.hasInnerMap()) {
innerObjectCollector.put(key, documentPropertyEntry.getValue());
}
if (inspection.hasInnerList()) {
innerArrayCollector.add(documentPropertyEntry.getValue());
}
}
}
if (hasCollector) {
for (ClassProperty collectorProperty : inspection.getCollectors()) {
try {
collectorProperty.getMutator().fire(object, collector);
} catch (IllegalAccessException ex) {
Logger.getLogger(JSONDocumentMarshaler.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalArgumentException ex) {
Logger.getLogger(JSONDocumentMarshaler.class.getName()).log(Level.SEVERE, null, ex);
} catch (InvocationTargetException ex) {
Logger.getLogger(JSONDocumentMarshaler.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
if (inspection.hasInnerMap()) {
}
if (inspection.hasInnerList()) {
}
}
return object;
}