Interface RequestAdapter


public interface RequestAdapter
Service responsible for translating abstract Request Info into concrete native HTTP requests.
  • Method Details

    • enableBackingStore

      void enableBackingStore(@Nullable BackingStoreFactory backingStoreFactory)
      Enables the backing store proxies for the SerializationWriters and ParseNodes in use.
      Parameters:
      backingStoreFactory - The backing store factory to use.
    • getSerializationWriterFactory

      @Nonnull SerializationWriterFactory getSerializationWriterFactory()
      Gets the serialization writer factory currently in use for the HTTP core service.
      Returns:
      the serialization writer factory currently in use for the HTTP core service.
    • send

      @Nullable <ModelType extends Parsable> ModelType send(@Nonnull RequestInformation requestInfo, @Nullable HashMap<String,ParsableFactory<? extends Parsable>> errorMappings, @Nonnull ParsableFactory<ModelType> factory)
      Executes the HTTP request specified by the given RequestInformation and returns the deserialized response model.
      Type Parameters:
      ModelType - the type of the response model to deserialize the response into.
      Parameters:
      requestInfo - the request info to execute.
      errorMappings - the error factories mapping to use in case of a failed request.
      factory - the factory to create the parsable object from the type discriminator.
      Returns:
      the deserialized response model.
    • sendCollection

      @Nullable <ModelType extends Parsable> List<ModelType> sendCollection(@Nonnull RequestInformation requestInfo, @Nullable HashMap<String,ParsableFactory<? extends Parsable>> errorMappings, @Nonnull ParsableFactory<ModelType> factory)
      Executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection.
      Type Parameters:
      ModelType - the type of the response model to deserialize the response into.
      Parameters:
      requestInfo - the request info to execute.
      errorMappings - the error factories mapping to use in case of a failed request.
      factory - the factory to create the parsable object from the type discriminator.
      Returns:
      the deserialized response model collection.
    • sendPrimitive

      @Nullable <ModelType> ModelType sendPrimitive(@Nonnull RequestInformation requestInfo, @Nullable HashMap<String,ParsableFactory<? extends Parsable>> errorMappings, @Nonnull Class<ModelType> targetClass)
      Executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive response model.
      Type Parameters:
      ModelType - the type of the response model to deserialize the response into.
      Parameters:
      requestInfo - the request info to execute.
      errorMappings - the error factories mapping to use in case of a failed request.
      targetClass - the class of the response model to deserialize the response into.
      Returns:
      the deserialized primitive response model.
    • sendPrimitiveCollection

      @Nullable <ModelType> List<ModelType> sendPrimitiveCollection(@Nonnull RequestInformation requestInfo, @Nullable HashMap<String,ParsableFactory<? extends Parsable>> errorMappings, @Nonnull Class<ModelType> targetClass)
      Executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive collection response model.
      Type Parameters:
      ModelType - the type of the response model to deserialize the response into.
      Parameters:
      requestInfo - the request info to execute.
      errorMappings - the error factories mapping to use in case of a failed request.
      targetClass - the class of the response model to deserialize the response into.
      Returns:
      the deserialized primitive collection response model.
    • sendEnum

      @Nullable <ModelType extends Enum<ModelType>> ModelType sendEnum(@Nonnull RequestInformation requestInfo, @Nullable HashMap<String,ParsableFactory<? extends Parsable>> errorMappings, @Nonnull ValuedEnumParser<ModelType> enumParser)
      Executes the HTTP request specified by the given RequestInformation and returns the deserialized enum value.
      Type Parameters:
      ModelType - the type of the response model to deserialize the response into.
      Parameters:
      requestInfo - the request info to execute.
      errorMappings - the error factories mapping to use in case of a failed request.
      enumParser - a parser from string to enum instances.
      Returns:
      the deserialized primitive response model.
    • sendEnumCollection

      @Nullable <ModelType extends Enum<ModelType>> List<ModelType> sendEnumCollection(@Nonnull RequestInformation requestInfo, @Nullable HashMap<String,ParsableFactory<? extends Parsable>> errorMappings, @Nonnull ValuedEnumParser<ModelType> enumParser)
      Executes the HTTP request specified by the given RequestInformation and returns the deserialized enum collection value.
      Type Parameters:
      ModelType - the type of the response model to deserialize the response into.
      Parameters:
      requestInfo - the request info to execute.
      errorMappings - the error factories mapping to use in case of a failed request.
      enumParser - a parser from string to enum instances.
      Returns:
      the deserialized primitive response model.
    • setBaseUrl

      void setBaseUrl(@Nonnull String baseUrl)
      Sets The base url for every request.
      Parameters:
      baseUrl - The base url for every request.
    • getBaseUrl

      @Nonnull String getBaseUrl()
      Gets The base url for every request.
      Returns:
      The base url for every request.
    • convertToNativeRequest

      @Nonnull <T> T convertToNativeRequest(@Nonnull RequestInformation requestInfo)
      Converts the given RequestInformation into a native HTTP request.
      Type Parameters:
      T - the type of the native HTTP request.
      Parameters:
      requestInfo - the request info to convert.
      Returns:
      the native HTTP request.