|
|
|
@ -21,12 +21,12 @@ public class JsonKeyReader @Inject constructor( |
|
|
|
|
root.isArray -> { |
|
|
|
|
for (entry in root) { |
|
|
|
|
val key = entry["key"] ?: entry["keys"] ?: throw IOException("Missing 'key' or 'keys' field") |
|
|
|
|
keys += mapper.treeToValue<XteaKey>(key) ?: throw IOException("Key must be non-null") |
|
|
|
|
keys += mapper.treeToValue<XteaKey?>(key) ?: throw IOException("Key must be non-null") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
root.isObject -> { |
|
|
|
|
for (entry in root.fields()) { |
|
|
|
|
keys += mapper.treeToValue<XteaKey>(entry.value) ?: throw IOException("Key must be non-null") |
|
|
|
|
keys += mapper.treeToValue<XteaKey?>(entry.value) ?: throw IOException("Key must be non-null") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else -> throw IOException("Root element must be an array or object") |
|
|
|
|