Skip to content

Commit

Permalink
Use opt to allow nulls in JSON objects
Browse files Browse the repository at this point in the history
  • Loading branch information
rchodava committed Dec 8, 2016
1 parent 20b51a6 commit d64de35
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -512,17 +512,17 @@ public char asCharacter() {

@Override
public double asDouble() {
return object.getDouble(name);
return object.optDouble(name);
}

@Override
public float asFloat() {
return (float) object.getDouble(name);
return (float) object.optDouble(name);
}

@Override
public int asInteger() {
return object.getInt(name);
return object.optInt(name);
}

public JsonArray asJsonArray() {
Expand Down Expand Up @@ -555,7 +555,7 @@ public LocalDateTime asLocalDateTime() {

@Override
public long asLong() {
return object.getLong(name);
return object.optLong(name);
}

@Override
Expand All @@ -565,7 +565,7 @@ public Object asObject(Class<?> type) {

@Override
public short asShort() {
return (short) (int) object.getInt(name);
return (short) (int) object.optInt(name);
}

@Override
Expand Down

0 comments on commit d64de35

Please sign in to comment.