public class GsonResultObject extends Object implements ResultObject
Constructor and Description |
---|
GsonResultObject(com.google.gson.JsonObject jsonObject,
GsonResultElementFactory resultElementFactory) |
Modifier and Type | Method and Description |
---|---|
<T> T |
as(Class<T> objectType)
Returns a value from this element.
|
BigDecimal |
asBigDecimal() |
BigInteger |
asBigInteger() |
boolean |
asBoolean() |
byte |
asByte() |
char |
asCharacter() |
double |
asDouble() |
float |
asFloat() |
int |
asInteger() |
long |
asLong() |
short |
asShort() |
String |
asString() |
boolean |
equals(Object o) |
ResultElement |
get(String elementName)
Returns the element with the given name from this result.
|
ResultCollection |
getAsCollection() |
ResultObject |
getAsObject() |
ResultPrimitive |
getAsPrimitive() |
com.google.gson.JsonObject |
getJsonObject() |
GsonResultElementFactory |
getResultElementFactory() |
int |
hashCode() |
boolean |
isResultCollection() |
boolean |
isResultObject() |
boolean |
isResultPrimitive() |
String |
toString() |
@ConstructorProperties(value={"jsonObject","resultElementFactory"}) @Generated(value="lombok") public GsonResultObject(com.google.gson.JsonObject jsonObject, GsonResultElementFactory resultElementFactory)
public boolean isResultPrimitive()
isResultPrimitive
in interface ResultElement
public boolean isResultCollection()
isResultCollection
in interface ResultElement
public boolean isResultObject()
isResultObject
in interface ResultElement
public ResultPrimitive getAsPrimitive() throws UnsupportedOperationException
getAsPrimitive
in interface ResultElement
UnsupportedOperationException
public ResultCollection getAsCollection() throws UnsupportedOperationException
getAsCollection
in interface ResultElement
UnsupportedOperationException
public ResultObject getAsObject()
getAsObject
in interface ResultElement
public boolean asBoolean() throws UnsupportedOperationException
asBoolean
in interface ResultElement
UnsupportedOperationException
public byte asByte() throws UnsupportedOperationException
asByte
in interface ResultElement
UnsupportedOperationException
public char asCharacter() throws UnsupportedOperationException
asCharacter
in interface ResultElement
UnsupportedOperationException
public String asString() throws UnsupportedOperationException
asString
in interface ResultElement
UnsupportedOperationException
public int asInteger() throws UnsupportedOperationException
asInteger
in interface ResultElement
UnsupportedOperationException
public short asShort() throws UnsupportedOperationException
asShort
in interface ResultElement
UnsupportedOperationException
public long asLong() throws UnsupportedOperationException
asLong
in interface ResultElement
UnsupportedOperationException
public float asFloat() throws UnsupportedOperationException
asFloat
in interface ResultElement
UnsupportedOperationException
public double asDouble() throws UnsupportedOperationException
asDouble
in interface ResultElement
UnsupportedOperationException
public BigInteger asBigInteger() throws UnsupportedOperationException
asBigInteger
in interface ResultElement
UnsupportedOperationException
public BigDecimal asBigDecimal() throws UnsupportedOperationException
asBigDecimal
in interface ResultElement
UnsupportedOperationException
public ResultElement get(String elementName) throws UnsupportedOperationException
get
in interface ResultObject
elementName
- The name of the element to be accessed.GsonResultPrimitive
representing the corresponding element.UnsupportedOperationException
- If the element is not an instance of ResultObject
.public <T> T as(Class<T> objectType) throws UnsupportedOperationException
Important: In order to deserialize a result element to an object of a given type, you have to
annotate all relevant field members of the respective class with ElementName
. For example:
class MyObject
{
@ElementName( "MANDT" )
SapClient sapClient;
}
as
in interface ResultObject
objectType
- The type into which the element value should be converted.T
.UnsupportedOperationException
- If the value could not be converted to the given type.@Generated(value="lombok") public com.google.gson.JsonObject getJsonObject()
@Generated(value="lombok") public GsonResultElementFactory getResultElementFactory()
@Generated(value="lombok") public boolean equals(Object o)
@Generated(value="lombok") public int hashCode()
@Generated(value="lombok") public String toString()
Copyright © 2017 SAP SE. All rights reserved.