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 Details

    • gsonBuilder

      @Nonnull protected final com.google.gson.GsonBuilder gsonBuilder
      The GsonBuilder instance to be used for deserialization.
  • Constructor Details

    • GsonResultElementFactory

      public GsonResultElementFactory(@Nonnull com.google.gson.GsonBuilder gsonBuilder)
      Creates a new GsonResultElementFactory instance.
      Parameters:
      gsonBuilder - The GsonBuilder instance to be used for deserialization.
  • Method Details

    • newPrimitive

      @Nonnull protected ResultPrimitive newPrimitive(@Nonnull com.google.gson.JsonElement resultElement)
      Returns a ResultPrimitive from the given resultElement.
      Parameters:
      resultElement - The JsonElement to be converted.
      Returns:
      The ResultPrimitive instance.
    • newObject

      @Nonnull protected ResultObject newObject(@Nonnull com.google.gson.JsonElement resultElement)
      Returns a ResultObject from the given resultElement.
      Parameters:
      resultElement - The JsonElement to be converted.
      Returns:
      The ResultObject instance.
    • newCollection

      @Nonnull protected ResultCollection newCollection(@Nonnull com.google.gson.JsonElement resultElement)
      Returns a ResultCollection from the given resultElement.
      Parameters:
      resultElement - The JsonElement 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 a ResultElement based on the given object.
      Specified by:
      create in interface ResultElementFactory<com.google.gson.JsonElement>
      Parameters:
      resultElement - The object to build the ResultElement from.
      Returns:
      A ResultElement created from the given object.
      Throws:
      IllegalArgumentException - If the given object could not be used to build a ResultElement.
    • getGsonBuilder

      @Nonnull public com.google.gson.GsonBuilder getGsonBuilder()
      The GsonBuilder instance to be used for deserialization.
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(@Nullable Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object