Package com.tangosol.net.management
Interface MapJsonBodyHandler
- All Superinterfaces:
com.tangosol.internal.http.BaseHttpHandler.BodyWriter<Map<String,
,Object>> Comparable<MapJsonBodyHandler>
public interface MapJsonBodyHandler
extends com.tangosol.internal.http.BaseHttpHandler.BodyWriter<Map<String,Object>>, Comparable<MapJsonBodyHandler>
A class that can serialize and deserialize
Maps
to and from json.- Since:
- 22.06
- Author:
- Jonathan Knight 2022.01.25
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault int
static MapJsonBodyHandler
Load aMapJsonBodyHandler
using the JVM'sServiceLoader
mechanism.default int
Return the priority of thisMapJsonBodyHandler
.default boolean
Returntrue
if thisMapJsonBodyHandler
is enabled.readMap
(InputStream in) Read a jsonInputStream
and deserialize into aMap
.void
write
(Map<String, Object> body, OutputStream out) Write the specifiedObject
to theOutputStream
.
-
Field Details
-
DEFAULT_PRIORITY
static final int DEFAULT_PRIORITYThe default priority.- See Also:
-
-
Method Details
-
write
Description copied from interface:com.tangosol.internal.http.BaseHttpHandler.BodyWriter
Write the specifiedObject
to theOutputStream
.- Specified by:
write
in interfacecom.tangosol.internal.http.BaseHttpHandler.BodyWriter<Map<String,
Object>> - Parameters:
body
- the object to writeout
- theOutputStream
to write to
-
readMap
Read a jsonInputStream
and deserialize into aMap
.- Parameters:
in
- theInputStream
containing json data- Returns:
- a
Map
of the deserialized json data
-
isEnabled
default boolean isEnabled()Returntrue
if thisMapJsonBodyHandler
is enabled.- Returns:
true
if thisMapJsonBodyHandler
is enabled
-
getPriority
default int getPriority()Return the priority of thisMapJsonBodyHandler
.The priority is used to determine which instance to use if multiple implementations are loaded by the service loader. The implementation that returns the lowest priority will be used.
The default implementation of this method returns
DEFAULT_PRIORITY
.- Returns:
- the priority of this
MapJsonBodyHandler
-
compareTo
- Specified by:
compareTo
in interfaceComparable<MapJsonBodyHandler>
-
ensureMapJsonBodyHandler
Load aMapJsonBodyHandler
using the JVM'sServiceLoader
mechanism.- Returns:
- a
MapJsonBodyHandler
loaded via theServiceLoader
- Throws:
IllegalStateException
- if noMapJsonBodyHandler
can be loaded
-