Class DerivedClassIdentifier

java.lang.Object
com.microsoft.graph.serializer.DerivedClassIdentifier

public class DerivedClassIdentifier extends Object
This class provides methods to get the derived class corresponding to the OData type when deserializing payloads.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new instance of the dereived class identifier.
  • Method Summary

    Modifier and Type
    Method
    Description
    identify(com.google.gson.JsonObject jsonObject, Class<?> parentClass)
    Get the derived class for the given JSON object This covers scenarios in which the service may return one of several derived types of a base object, which it defines using the odata.type parameter

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DerivedClassIdentifier

      public DerivedClassIdentifier(@Nonnull ILogger logger)
      Creates a new instance of the dereived class identifier.
      Parameters:
      logger - The logger to use.
  • Method Details

    • identify

      @Nullable public Class<?> identify(@Nonnull com.google.gson.JsonObject jsonObject, @Nullable Class<?> parentClass)
      Get the derived class for the given JSON object This covers scenarios in which the service may return one of several derived types of a base object, which it defines using the odata.type parameter
      Parameters:
      jsonObject - the raw JSON object of the response
      parentClass - the parent class the derived class should inherit from
      Returns:
      the derived class if found, or null if not applicable