Class AbstractStub

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Logger logger
      The logger for log messages, especially data lost when throwing an exception.
      protected Supplier<com.fasterxml.jackson.databind.ObjectMapper> om
      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.
    • Field Detail

      • 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 Detail

      • 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 Detail

      • 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.