Package com.microsoft.graph.serializer
Class DerivedClassIdentifier
java.lang.Object
com.microsoft.graph.serializer.DerivedClassIdentifier
This class provides methods to get the derived class corresponding to the OData type when deserializing payloads.
-
Constructor Summary
ConstructorsConstructorDescriptionDerivedClassIdentifier(ILogger logger)Creates a new instance of the dereived class identifier. -
Method Summary
Modifier and TypeMethodDescriptionClass<?>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
-
Constructor Details
-
DerivedClassIdentifier
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 responseparentClass- the parent class the derived class should inherit from- Returns:
- the derived class if found, or null if not applicable
-