DerivedClassIdentifier Class

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

public class DerivedClassIdentifier

This class provides methods to get the derived class corresponding to the OData type when deserializing payloads.

Constructor Summary

Constructor Description
DerivedClassIdentifier(ILogger logger)

Creates a new instance of the dereived class identifier.

Method Summary

Modifier and Type Method and Description
java.lang.Class<?> identify(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 java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

DerivedClassIdentifier

public DerivedClassIdentifier(ILogger logger)

Creates a new instance of the dereived class identifier.

Parameters:

logger - The logger to use.

Method Details

identify

public Class identify(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

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

Applies to