public class GsonResultPrimitive extends Object implements ResultPrimitive
ResultPrimitive
implementation based on a JsonPrimitive
.Constructor and Description |
---|
GsonResultPrimitive(com.google.gson.JsonPrimitive jsonPrimitive) |
Modifier and Type | Method and Description |
---|---|
BigDecimal |
asBigDecimal()
Returns a value from this element.
|
BigInteger |
asBigInteger()
Returns a value from this element.
|
boolean |
asBoolean()
Returns a value from this element.
|
byte |
asByte()
Returns a value from this element.
|
char |
asCharacter()
Returns a value from this element.
|
double |
asDouble()
Returns a value from this element.
|
float |
asFloat()
Returns a value from this element.
|
int |
asInteger()
Returns a value from this element.
|
long |
asLong()
Returns a value from this element.
|
short |
asShort()
Returns a value from this element.
|
String |
asString()
Returns a value from this element.
|
boolean |
equals(Object o) |
ResultCollection |
getAsCollection()
Returns this
ResultElement as an instance of ResultCollection . |
ResultObject |
getAsObject()
Returns this
ResultElement as an instance of ResultObject . |
ResultPrimitive |
getAsPrimitive()
Returns this
ResultElement as an instance of ResultPrimitive . |
com.google.gson.JsonPrimitive |
getJsonPrimitive() |
int |
hashCode() |
boolean |
isResultCollection()
Checks whether this
ResultElement represents a collection of result elements and, therefore, is a
ResultCollection . |
boolean |
isResultObject()
Checks whether this
ResultElement represents a structured object and, therefore, is a
ResultObject . |
boolean |
isResultPrimitive()
Checks whether this
ResultElement represents an unstructured value and, therefore, is a
ResultPrimitive . |
String |
toString() |
public GsonResultPrimitive(com.google.gson.JsonPrimitive jsonPrimitive)
public boolean isResultPrimitive()
ResultElement
ResultElement
represents an unstructured value and, therefore, is a
ResultPrimitive
.isResultPrimitive
in interface ResultElement
ResultPrimitive
, otherwise falsepublic boolean isResultCollection()
ResultElement
ResultElement
represents a collection of result elements and, therefore, is a
ResultCollection
.isResultCollection
in interface ResultElement
ResultCollection
, otherwise falsepublic boolean isResultObject()
ResultElement
ResultElement
represents a structured object and, therefore, is a
ResultObject
.isResultObject
in interface ResultElement
ResultObject
, otherwise falsepublic ResultPrimitive getAsPrimitive()
ResultElement
ResultElement
as an instance of ResultPrimitive
.getAsPrimitive
in interface ResultElement
ResultPrimitive
public ResultCollection getAsCollection() throws UnsupportedOperationException
ResultElement
ResultElement
as an instance of ResultCollection
.getAsCollection
in interface ResultElement
ResultCollection
UnsupportedOperationException
- If the cast into ResultCollection
failed, e.g. in case it is not a collectionpublic ResultObject getAsObject() throws UnsupportedOperationException
ResultElement
ResultElement
as an instance of ResultObject
.getAsObject
in interface ResultElement
ResultObject
UnsupportedOperationException
- If the cast into ResultObject
failed, e.g. in case it is not an objectpublic boolean asBoolean() throws UnsupportedOperationException
boolean
.asBoolean
in interface ResultElement
asBoolean
in interface ResultPrimitive
boolean
.UnsupportedOperationException
- If the value could not be converted to the given type.public byte asByte() throws UnsupportedOperationException
byte
.asByte
in interface ResultElement
asByte
in interface ResultPrimitive
byte
.UnsupportedOperationException
- If the value could not be converted to the given type.public char asCharacter() throws UnsupportedOperationException
char
.asCharacter
in interface ResultElement
asCharacter
in interface ResultPrimitive
char
.UnsupportedOperationException
- If the value could not be converted to the given type.public String asString() throws UnsupportedOperationException
String
.asString
in interface ResultElement
asString
in interface ResultPrimitive
String
.UnsupportedOperationException
- If the value could not be converted to the given type.public int asInteger() throws UnsupportedOperationException
int
.asInteger
in interface ResultElement
asInteger
in interface ResultPrimitive
int
.UnsupportedOperationException
- If the value could not be converted to the given type.public short asShort() throws UnsupportedOperationException
short
.asShort
in interface ResultElement
asShort
in interface ResultPrimitive
short
.UnsupportedOperationException
- If the value could not be converted to the given type.public long asLong() throws UnsupportedOperationException
long
.asLong
in interface ResultElement
asLong
in interface ResultPrimitive
long
.UnsupportedOperationException
- If the value could not be converted to the given type.public float asFloat() throws UnsupportedOperationException
float
.asFloat
in interface ResultElement
asFloat
in interface ResultPrimitive
float
.UnsupportedOperationException
- If the value could not be converted to the given type.public double asDouble() throws UnsupportedOperationException
double
.asDouble
in interface ResultElement
asDouble
in interface ResultPrimitive
double
.UnsupportedOperationException
- If the value could not be converted to the given type.public BigInteger asBigInteger() throws UnsupportedOperationException
BigInteger
.asBigInteger
in interface ResultElement
asBigInteger
in interface ResultPrimitive
BigInteger
.UnsupportedOperationException
- If the value could not be converted to the given type.public BigDecimal asBigDecimal() throws UnsupportedOperationException
BigDecimal
.asBigDecimal
in interface ResultElement
asBigDecimal
in interface ResultPrimitive
BigDecimal
.UnsupportedOperationException
- If the value could not be converted to the given type.public com.google.gson.JsonPrimitive getJsonPrimitive()
Copyright © 2018 SAP SE. All rights reserved.