Class ResponseBodyHandler<T extends com.microsoft.kiota.serialization.Parsable>
java.lang.Object
com.microsoft.graph.core.requests.ResponseBodyHandler<T>
- Type Parameters:
T- the ModelType of the response body.
- All Implemented Interfaces:
com.microsoft.kiota.ResponseHandler
public class ResponseBodyHandler<T extends com.microsoft.kiota.serialization.Parsable>
extends Object
implements com.microsoft.kiota.ResponseHandler
A response handler for deserializing responses to a ModelType. Particularly for Batch requests.
-
Constructor Summary
ConstructorsConstructorDescriptionResponseBodyHandler(com.microsoft.kiota.serialization.ParsableFactory<T> factory) Instantiates a new response handler.ResponseBodyHandler(com.microsoft.kiota.serialization.ParseNodeFactory parseNodeFactory, com.microsoft.kiota.serialization.ParsableFactory<T> factory) Instantiates a new response handler. -
Method Summary
Modifier and TypeMethodDescription<NativeResponseType,ModelType>
ModelTypehandleResponse(NativeResponseType response, HashMap<String, com.microsoft.kiota.serialization.ParsableFactory<? extends com.microsoft.kiota.serialization.Parsable>> errorMappings) Handles the response and returns the deserialized response body as a ModelType.
-
Constructor Details
-
ResponseBodyHandler
public ResponseBodyHandler(@Nullable com.microsoft.kiota.serialization.ParseNodeFactory parseNodeFactory, @Nonnull com.microsoft.kiota.serialization.ParsableFactory<T> factory) Instantiates a new response handler.- Parameters:
parseNodeFactory- the parse node factory to use when deserializing the response.factory- the factory to use when deserializing the response to a ModelType.
-
ResponseBodyHandler
Instantiates a new response handler.- Parameters:
factory- the factory to use when deserializing the response to a ModelType.
-
-
Method Details
-
handleResponse
@Nullable public <NativeResponseType,ModelType> ModelType handleResponse(@Nonnull NativeResponseType response, @Nullable HashMap<String, com.microsoft.kiota.serialization.ParsableFactory<? extends com.microsoft.kiota.serialization.Parsable>> errorMappings) Handles the response and returns the deserialized response body as a ModelType.- Specified by:
handleResponsein interfacecom.microsoft.kiota.ResponseHandler- Type Parameters:
NativeResponseType- The type of the native response object.ModelType- The type of the response model object.- Parameters:
response- The native response object.errorMappings- the error mappings for the response to use when deserializing failed responses bodies. Where an error code like 401 applies specifically to that status code, a class code like 4XX applies to all status codes within the range if an the specific error code is not present.- Returns:
- the deserialized response.
-