Interface Serializer
- All Superinterfaces:
Comparable<Serializer>,JolokiaService<Serializer>
Interface defining a Jolokia serializer which is also a plugable service. This interface
is still connected to json-simple, but this dependency might be removed in
the future.
- Since:
- 02.10.13
- Author:
- roland
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jolokia.server.core.service.api.JolokiaService
JolokiaService.Init -
Method Summary
Modifier and TypeMethodDescriptiondeserialize(String pExpectedClassName, Object pValue) Convert value from a either a given object or its string representation.deserializeOpenType(OpenType<?> pOpenType, Object pValue) Handle conversion for OpenTypes.serialize(Object pValue, List<String> pPathParts, SerializeOptions pOptions) Convert the return value to a JSON object.setInnerValue(Object pOuterObject, Object pNewValue, List<String> pPathParts) Set an inner value of a complex object.Methods inherited from interface java.lang.Comparable
compareToMethods inherited from interface org.jolokia.server.core.service.api.JolokiaService
destroy, getOrder, getType, init
-
Method Details
-
serialize
Object serialize(Object pValue, List<String> pPathParts, SerializeOptions pOptions) throws AttributeNotFoundException Convert the return value to a JSON object.- Parameters:
pValue- the value to convertpPathParts- path parts to use for extractionpOptions- options used for parsing- Returns:
- the converter object. This either a subclass of
JSONAwareor a basic data type like String or Long. - Throws:
AttributeNotFoundException- if within an path an attribute could not be found
-
deserialize
Convert value from a either a given object or its string representation. If the value is already assignable to the given class name it is returned directly.- Parameters:
pExpectedClassName- type name of the expected typepValue- value to either take directly or to convert from its string representation.- Returns:
- the converted object which is of type
pExpectedClassName
-
setInnerValue
Object setInnerValue(Object pOuterObject, Object pNewValue, List<String> pPathParts) throws AttributeNotFoundException, IllegalAccessException, InvocationTargetException Set an inner value of a complex object. A given path must point to the attribute/index to set within the outer object.- Parameters:
pOuterObject- the object to dive inpNewValue- the value to setpPathParts- the path within the outer object. This object will be modified and must be a modifiable list.- Returns:
- the old value
- Throws:
AttributeNotFoundExceptionIllegalAccessExceptionInvocationTargetException
-
deserializeOpenType
Handle conversion for OpenTypes. The value is expected to be in JSON (either anJSONAwareobject or its string representation.- Parameters:
pOpenType- target typepValue- value to convert from- Returns:
- the converted value
-