First prototype to validate phone numbers

This commit is contained in:
Maxime Dor
2017-09-25 05:53:07 +02:00
parent 6c2e65ace5
commit c73bbf675e
36 changed files with 958 additions and 217 deletions

View File

@@ -62,6 +62,14 @@ public class GsonParser {
return gson.fromJson(parse(res.getEntity().getContent()), type);
}
public Optional<JsonObject> parseOptional(HttpResponse res) {
try {
return Optional.of(parse(res.getEntity().getContent()));
} catch (IOException e) {
return Optional.empty();
}
}
public JsonObject parse(InputStream stream, String property) throws IOException {
JsonObject obj = parse(stream);
if (!obj.has(property)) {