The ClaimImpl class implements the Claim interface.
| 15 | * The ClaimImpl class implements the Claim interface. |
| 16 | */ |
| 17 | class ClaimImpl extends BaseClaim { |
| 18 | |
| 19 | private final JsonElement value; |
| 20 | |
| 21 | ClaimImpl(@NonNull JsonElement value) { |
| 22 | this.value = value; |
| 23 | } |
| 24 | |
| 25 | @Override |
| 26 | @Nullable |
| 27 | public Boolean asBoolean() { |
| 28 | if (!value.isJsonPrimitive()) { |
| 29 | return null; |
| 30 | } |
| 31 | return value.getAsBoolean(); |
| 32 | } |
| 33 | |
| 34 | @Override |
| 35 | @Nullable |
| 36 | public Integer asInt() { |
| 37 | if (!value.isJsonPrimitive()) { |
| 38 | return null; |
| 39 | } |
| 40 | return value.getAsInt(); |
| 41 | } |
| 42 | |
| 43 | @Override |
| 44 | @Nullable |
| 45 | public Long asLong() { |
| 46 | if (!value.isJsonPrimitive()) { |
| 47 | return null; |
| 48 | } |
| 49 | return value.getAsLong(); |
| 50 | } |
| 51 | |
| 52 | @Override |
| 53 | @Nullable |
| 54 | public Double asDouble() { |
| 55 | if (!value.isJsonPrimitive()) { |
| 56 | return null; |
| 57 | } |
| 58 | return value.getAsDouble(); |
| 59 | } |
| 60 | |
| 61 | @Override |
| 62 | @Nullable |
| 63 | public String asString() { |
| 64 | if (!value.isJsonPrimitive()) { |
| 65 | return null; |
| 66 | } |
| 67 | return value.getAsString(); |
| 68 | } |
| 69 | |
| 70 | @Override |
| 71 | @Nullable |
| 72 | public Date asDate() { |
| 73 | if (!value.isJsonPrimitive()) { |
| 74 | return null; |
nothing calls this directly
no outgoing calls
no test coverage detected