summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-05-09 10:29:54 +0200
committerPeter Wu <peter@lekensteyn.nl>2014-05-09 10:29:54 +0200
commit92957d639b8eeaddb570725f7dc9dc9cc0080b0f (patch)
tree5c81881b505fa5e7c3616c93c7ecc5faf02bdda9 /src
parent9f29e6f164c83eb00b434467bd2c4257ec827c36 (diff)
downloadDatafiller-92957d639b8eeaddb570725f7dc9dc9cc0080b0f.tar.gz
Remove debug prints, add comments
Diffstat (limited to 'src')
-rw-r--r--src/data/ValidatingJsonDeserializer.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/data/ValidatingJsonDeserializer.java b/src/data/ValidatingJsonDeserializer.java
index 8711f59..e38f68f 100644
--- a/src/data/ValidatingJsonDeserializer.java
+++ b/src/data/ValidatingJsonDeserializer.java
@@ -36,7 +36,6 @@ public class ValidatingJsonDeserializer<T> implements JsonDeserializer<T> {
}
JsonObject jsonObj = je.getAsJsonObject();
for (Field f : type.getDeclaredFields()) {
- System.err.println("verif " + f.getName());
if (!jsonObj.has(f.getName())) {
if (f.getAnnotation(Nullable.class) != null) {
// null allowed, skip
@@ -55,15 +54,18 @@ public class ValidatingJsonDeserializer<T> implements JsonDeserializer<T> {
if (v != null) {
Class<?> type = f.getType();
if (type.isArray()) {
+ // the class expects an array, so the value must have one too.
if (!je.isJsonArray()) {
throw new JsonParseException("Not an array: " + f.getName());
}
JsonArray ja = je.getAsJsonArray();
type = type.getComponentType();
+ // for each array element, check if the object is valid.
for (JsonElement arr_je : ja) {
checkObject(arr_je, type);
}
} else {
+ // not an array, assume a verifiable object
checkObject(je, type);
}
}