diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-05-09 10:29:54 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2014-05-09 10:29:54 +0200 |
commit | 92957d639b8eeaddb570725f7dc9dc9cc0080b0f (patch) | |
tree | 5c81881b505fa5e7c3616c93c7ecc5faf02bdda9 /src | |
parent | 9f29e6f164c83eb00b434467bd2c4257ec827c36 (diff) | |
download | Datafiller-92957d639b8eeaddb570725f7dc9dc9cc0080b0f.tar.gz |
Remove debug prints, add comments
Diffstat (limited to 'src')
-rw-r--r-- | src/data/ValidatingJsonDeserializer.java | 4 |
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); } } |