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 deserializeMaps
to and from json.- Since:
- 22.06
- Author:
- Jonathan Knight 2022.01.25
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_PRIORITY
The default priority.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default int
compareTo(MapJsonBodyHandler o)
static MapJsonBodyHandler
ensureMapJsonBodyHandler()
Load aMapJsonBodyHandler
using the JVM'sServiceLoader
mechanism.default int
getPriority()
Return the priority of thisMapJsonBodyHandler
.default boolean
isEnabled()
Returntrue
if thisMapJsonBodyHandler
is enabled.Map<String,Object>
readMap(InputStream in)
Read a jsonInputStream
and deserialize into aMap
.void
write(Map<String,Object> body, OutputStream out)
Write the specifiedObject
to theOutputStream
.
-
-
-
Field Detail
-
DEFAULT_PRIORITY
static final int DEFAULT_PRIORITY
The default priority.- See Also:
- Constant Field Values
-
-
Method Detail
-
write
void write(Map<String,Object> body, OutputStream out)
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
Map<String,Object> readMap(InputStream in)
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
default int compareTo(MapJsonBodyHandler o)
- Specified by:
compareTo
in interfaceComparable<MapJsonBodyHandler>
-
ensureMapJsonBodyHandler
static MapJsonBodyHandler ensureMapJsonBodyHandler()
Load aMapJsonBodyHandler
using the JVM'sServiceLoader
mechanism.- Returns:
- a
MapJsonBodyHandler
loaded via theServiceLoader
- Throws:
IllegalStateException
- if noMapJsonBodyHandler
can be loaded
-
-