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 LoggerloggerThe logger for log messages, especially data lost when throwing an exception.protected Supplier<com.fasterxml.jackson.databind.ObjectMapper>omThe object mapper (supplier) for reading JSON objects from responses (including exceptions).
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractStub(Supplier<com.fasterxml.jackson.databind.ObjectMapper> om, LogService logService)Creates a new abstract stub providing the basic means for making callback calls.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> StringgetJsonFor(Class<T> cls, T value)Gets the JSON representation of the designated value for the designated class.
-
-
-
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, anIOExceptionwill be thrown.
-
-