public class GsonResultPrimitive extends Object implements ResultPrimitive
ResultPrimitive
implementation based on a JsonPrimitive
.Modifier and Type | Field and Description |
---|---|
protected com.google.gson.JsonPrimitive |
jsonPrimitive |
Constructor and Description |
---|
GsonResultPrimitive(com.google.gson.JsonPrimitive jsonPrimitive) |
Modifier and Type | Method and Description |
---|---|
BigDecimal |
asBigDecimal()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as BigDecimal . |
BigInteger |
asBigInteger()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as BigInteger . |
boolean |
asBoolean()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as boolean . |
byte |
asByte()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as byte . |
char |
asCharacter()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as char . |
double |
asDouble()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as double . |
float |
asFloat()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as float . |
int |
asInteger()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as int . |
long |
asLong()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as long . |
short |
asShort()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as short . |
String |
asString()
In case this
ResultElement is considered a ResultPrimitive , use this method to access its value
as String . |
protected boolean |
canEqual(Object other) |
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
represents an unstructured value and, therefore, is a
ResultPrimitive
.isResultPrimitive
in interface ResultElement
ResultPrimitive
, otherwise falsepublic boolean isResultCollection()
ResultElement
represents a collection of result elements and, therefore, is a
ResultCollection
.isResultCollection
in interface ResultElement
ResultCollection
, otherwise falsepublic boolean isResultObject()
ResultElement
represents a structured object and, therefore, is a
ResultObject
.isResultObject
in interface ResultElement
ResultObject
, otherwise falsepublic ResultPrimitive getAsPrimitive()
ResultElement
as an instance of ResultPrimitive
.getAsPrimitive
in interface ResultElement
ResultPrimitive
public ResultCollection getAsCollection() throws UnsupportedOperationException
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
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
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as boolean
.asBoolean
in interface ResultElement
asBoolean
in interface ResultPrimitive
boolean
valueUnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as boolean
public byte asByte() throws UnsupportedOperationException
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as byte
.asByte
in interface ResultElement
asByte
in interface ResultPrimitive
byte
valueUnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as byte
public char asCharacter() throws UnsupportedOperationException
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as char
.asCharacter
in interface ResultElement
asCharacter
in interface ResultPrimitive
char
valueUnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as char
public String asString() throws UnsupportedOperationException
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as String
.asString
in interface ResultElement
asString
in interface ResultPrimitive
String
objectUnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as String
public int asInteger() throws UnsupportedOperationException
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as int
.asInteger
in interface ResultElement
asInteger
in interface ResultPrimitive
int
valueUnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as int
public short asShort() throws UnsupportedOperationException
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as short
.asShort
in interface ResultElement
asShort
in interface ResultPrimitive
short
valueUnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as short
public long asLong() throws UnsupportedOperationException
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as long
.asLong
in interface ResultElement
asLong
in interface ResultPrimitive
long
valueUnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as long
public float asFloat() throws UnsupportedOperationException
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as float
.asFloat
in interface ResultElement
asFloat
in interface ResultPrimitive
float
valueUnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as float
public double asDouble() throws UnsupportedOperationException
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as double
.asDouble
in interface ResultElement
asDouble
in interface ResultPrimitive
double
valueUnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as double
public BigInteger asBigInteger() throws UnsupportedOperationException
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as BigInteger
.asBigInteger
in interface ResultElement
asBigInteger
in interface ResultPrimitive
BigInteger
objectUnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as BigInteger
public BigDecimal asBigDecimal() throws UnsupportedOperationException
ResultElement
is considered a ResultPrimitive
, use this method to access its value
as BigDecimal
.asBigDecimal
in interface ResultElement
asBigDecimal
in interface ResultPrimitive
BigDecimal
objectUnsupportedOperationException
- If this ResultElement
is not considered a ResultPrimitive
or its value cannot be
represented as BigDecimal
public com.google.gson.JsonPrimitive getJsonPrimitive()
protected boolean canEqual(Object other)
Copyright © 2018 SAP SE. All rights reserved.