Package com.sap.cloud.sdk.result
Class GsonResultElementFactory
java.lang.Object
com.sap.cloud.sdk.result.GsonResultElementFactory
- All Implemented Interfaces:
ResultElementFactory<com.google.gson.JsonElement>
- Direct Known Subclasses:
SoapGsonResultElementFactory
public class GsonResultElementFactory
extends Object
implements ResultElementFactory<com.google.gson.JsonElement>
Factory implementation that creates a
ResultElement
, based on a given JsonElement
.-
Field Summary
Modifier and TypeFieldDescriptionprotected final com.google.gson.GsonBuilder
TheGsonBuilder
instance to be used for deserialization. -
Constructor Summary
ConstructorDescriptionGsonResultElementFactory
(com.google.gson.GsonBuilder gsonBuilder) Creates a newGsonResultElementFactory
instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
create
(com.google.gson.JsonElement resultElement) Creates aResultElement
based on the given object.boolean
com.google.gson.GsonBuilder
TheGsonBuilder
instance to be used for deserialization.int
hashCode()
protected ResultCollection
newCollection
(com.google.gson.JsonElement resultElement) Returns aResultCollection
from the givenresultElement
.protected ResultObject
newObject
(com.google.gson.JsonElement resultElement) Returns aResultObject
from the givenresultElement
.protected ResultPrimitive
newPrimitive
(com.google.gson.JsonElement resultElement) Returns aResultPrimitive
from the givenresultElement
.toString()
-
Field Details
-
gsonBuilder
@Nonnull protected final com.google.gson.GsonBuilder gsonBuilderTheGsonBuilder
instance to be used for deserialization.
-
-
Constructor Details
-
GsonResultElementFactory
public GsonResultElementFactory(@Nonnull com.google.gson.GsonBuilder gsonBuilder) Creates a newGsonResultElementFactory
instance.- Parameters:
gsonBuilder
- TheGsonBuilder
instance to be used for deserialization.
-
-
Method Details
-
newPrimitive
Returns aResultPrimitive
from the givenresultElement
.- Parameters:
resultElement
- TheJsonElement
to be converted.- Returns:
- The
ResultPrimitive
instance.
-
newObject
Returns aResultObject
from the givenresultElement
.- Parameters:
resultElement
- TheJsonElement
to be converted.- Returns:
- The
ResultObject
instance.
-
newCollection
@Nonnull protected ResultCollection newCollection(@Nonnull com.google.gson.JsonElement resultElement) Returns aResultCollection
from the givenresultElement
.- Parameters:
resultElement
- TheJsonElement
to be converted.- Returns:
- The
ResultCollection
instance.
-
create
@Nullable public ResultElement create(@Nullable com.google.gson.JsonElement resultElement) throws IllegalArgumentException Description copied from interface:ResultElementFactory
Creates aResultElement
based on the given object.- Specified by:
create
in interfaceResultElementFactory<com.google.gson.JsonElement>
- Parameters:
resultElement
- The object to build theResultElement
from.- Returns:
- A
ResultElement
created from the given object. - Throws:
IllegalArgumentException
- If the given object could not be used to build aResultElement
.
-
getGsonBuilder
@Nonnull public com.google.gson.GsonBuilder getGsonBuilder()TheGsonBuilder
instance to be used for deserialization. -
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-