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>
public class GsonResultElementFactory
extends Object
implements ResultElementFactory<com.google.gson.JsonElement>
Factory implementation that creates a
ResultElement, based on a given JsonElement.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.google.gson.GsonBuilderTheGsonBuilderinstance to be used for deserialization. -
Constructor Summary
ConstructorsConstructorDescriptionGsonResultElementFactory(com.google.gson.GsonBuilder gsonBuilder) Creates a newGsonResultElementFactoryinstance. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancreate(com.google.gson.JsonElement resultElement) Creates aResultElementbased on the given object.booleancom.google.gson.GsonBuilderTheGsonBuilderinstance to be used for deserialization.inthashCode()protected ResultCollectionnewCollection(com.google.gson.JsonElement resultElement) Returns aResultCollectionfrom the givenresultElement.protected ResultObjectnewObject(com.google.gson.JsonElement resultElement) Returns aResultObjectfrom the givenresultElement.protected ResultPrimitivenewPrimitive(com.google.gson.JsonElement resultElement) Returns aResultPrimitivefrom the givenresultElement.toString()
-
Field Details
-
gsonBuilder
@Nonnull protected final com.google.gson.GsonBuilder gsonBuilderTheGsonBuilderinstance to be used for deserialization.
-
-
Constructor Details
-
GsonResultElementFactory
public GsonResultElementFactory(@Nonnull com.google.gson.GsonBuilder gsonBuilder) Creates a newGsonResultElementFactoryinstance.- Parameters:
gsonBuilder- TheGsonBuilderinstance to be used for deserialization.
-
-
Method Details
-
newPrimitive
Returns aResultPrimitivefrom the givenresultElement.- Parameters:
resultElement- TheJsonElementto be converted.- Returns:
- The
ResultPrimitiveinstance.
-
newObject
Returns aResultObjectfrom the givenresultElement.- Parameters:
resultElement- TheJsonElementto be converted.- Returns:
- The
ResultObjectinstance.
-
newCollection
@Nonnull protected ResultCollection newCollection(@Nonnull com.google.gson.JsonElement resultElement) Returns aResultCollectionfrom the givenresultElement.- Parameters:
resultElement- TheJsonElementto be converted.- Returns:
- The
ResultCollectioninstance.
-
create
@Nullable public ResultElement create(@Nullable com.google.gson.JsonElement resultElement) throws IllegalArgumentException Description copied from interface:ResultElementFactoryCreates aResultElementbased on the given object.- Specified by:
createin interfaceResultElementFactory<com.google.gson.JsonElement>- Parameters:
resultElement- The object to build theResultElementfrom.- Returns:
- A
ResultElementcreated 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()TheGsonBuilderinstance to be used for deserialization. -
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-