public final class ObjectToJsonConverter extends Object
Constructor and Description |
---|
ObjectToJsonConverter(StringToObjectConverter pStringToObjectConverter,
Extractor... pSimplifyHandlers)
New object-to-json converter
|
Modifier and Type | Method and Description |
---|---|
Object |
convertToJson(Object pValue,
List<String> pPathParts,
JsonConvertOptions pOptions)
Convert the return value to a JSON object.
|
Object |
extractObject(Object pValue,
Stack<String> pPathParts,
boolean pJsonify)
Related to
extractObjectWithContext(java.lang.Object, java.util.Stack<java.lang.String>, org.jolokia.converter.json.JsonConvertOptions, boolean) except that
it does not setup a context. |
ValueFaultHandler |
getValueFaultHandler()
Get the fault handler used for dealing with exceptions during value extraction.
|
Object |
setInnerValue(Object pOuterObject,
Object pNewValue,
List<String> pPathParts)
Set an inner value of a complex object.
|
public ObjectToJsonConverter(StringToObjectConverter pStringToObjectConverter, Extractor... pSimplifyHandlers)
pStringToObjectConverter
- used when setting valuespSimplifyHandlers
- a bunch of simplifiers used for mangling the conversion resultpublic Object convertToJson(Object pValue, List<String> pPathParts, JsonConvertOptions pOptions) throws AttributeNotFoundException
pValue
- the value to convertpPathParts
- path parts to use for extractionpOptions
- options used for parsingJSONAware
or a basic data type like String or Long.AttributeNotFoundException
- if within an path an attribute could not be foundpublic Object setInnerValue(Object pOuterObject, Object pNewValue, List<String> pPathParts) throws AttributeNotFoundException, IllegalAccessException, InvocationTargetException
pOuterObject
- the object to dive inpNewValue
- the value to setpPathParts
- the path within the outer object. This object will be modified and be a modifiable list.AttributeNotFoundException
IllegalAccessException
InvocationTargetException
public Object extractObject(Object pValue, Stack<String> pPathParts, boolean pJsonify) throws AttributeNotFoundException
extractObjectWithContext(java.lang.Object, java.util.Stack<java.lang.String>, org.jolokia.converter.json.JsonConvertOptions, boolean)
except that
it does not setup a context. This method is called back from the
various extractors to recursively continue the extraction, hence it is public.
This method must not be used as entry point for serialization.
Use convertToJson(Object, List, JsonConvertOptions)
or
setInnerValue(Object, Object, List)
instead.pValue
- value to extract frompPathParts
- stack for diving into the objectpJsonify
- whether a JSON representation JSONObject
JSONObject
AttributeNotFoundException
- if an attribute is not found during traversalpublic ValueFaultHandler getValueFaultHandler()
Copyright © 2016. All rights reserved.