Class AbstractStub

java.lang.Object
de.aristaflow.ilm.ws.rest.base.service.AbstractStub
Direct Known Subclasses:
AbstractRestStub, AbstractSseStub

public class AbstractStub extends Object
This class provides the basic means for making REST callback calls
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final Logger
    The logger for log messages, especially data lost when throwing an exception.
    protected final Supplier<com.fasterxml.jackson.databind.ObjectMapper>
    The object mapper (supplier) for reading JSON objects from responses (including exceptions).
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractStub(Supplier<com.fasterxml.jackson.databind.ObjectMapper> om, LogService logService)
    Creates a new abstract stub providing the basic means for making callback calls.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> String
    getJsonFor(Class<T> cls, T value)
    Gets the JSON representation of the designated value for the designated class.

    Methods inherited from class java.lang.Object

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

    • logger

      protected final Logger logger
      The logger for log messages, especially data lost when throwing an exception.
    • om

      protected final Supplier<com.fasterxml.jackson.databind.ObjectMapper> om
      The object mapper (supplier) for reading JSON objects from responses (including exceptions).
  • Constructor Details

    • AbstractStub

      protected AbstractStub(Supplier<com.fasterxml.jackson.databind.ObjectMapper> om, LogService logService)
      Creates a new abstract stub providing the basic means for making callback calls.
      Parameters:
      om - The object mapper (supplier) for reading JSON objects from responses (including exceptions).
      logService - The log service for creating class-specific loggers.
  • Method Details

    • getJsonFor

      public <T> String getJsonFor(Class<T> cls, T value) throws IOException
      Gets the JSON representation of the designated value for the designated class.
      Parameters:
      cls - The class for which to get the JSON representation for an instance.
      value - The instance of the designated class for which the JSON representation.
      Returns:
      The JSON representation for the designated value being an instance of the designated class.
      Throws:
      IOException - If there are problems creating the JSON representation, an IOException will be thrown.