Class ArrayExtractor
java.lang.Object
org.jolokia.service.serializer.json.ArrayExtractor
- All Implemented Interfaces:
Extractor
Extractor for extracting arrays of any kind.
- Since:
- Apr 19, 2009
- Author:
- roland
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether this extractor is able to set a value.extractObject(ObjectToJsonConverter pConverter, Object pValue, Deque<String> pPathParts, boolean jsonify) Extract an array and, if to be jsonified, put it into anJSONArray.Class<?>getType()Type for which this extractor can objects of this typesetObjectValue(StringToObjectConverter pConverter, Object pInner, String pIndex, Object pValue) Set a value in an array
-
Constructor Details
-
ArrayExtractor
public ArrayExtractor()
-
-
Method Details
-
getType
Type for which this extractor can objects of this type -
extractObject
public Object extractObject(ObjectToJsonConverter pConverter, Object pValue, Deque<String> pPathParts, boolean jsonify) throws AttributeNotFoundException Extract an array and, if to be jsonified, put it into anJSONArray. An index can be used (on top of the extra args stack) in order to specify a single value within the array.- Specified by:
extractObjectin interfaceExtractor- Parameters:
pConverter- the global converter in order to be able do dispatch for serializing inner data typespValue- the value to convert (must be an aary)pPathParts- extra arguments stack, which is popped to get an index for extracting a single element of the arrayjsonify- whether to convert to a JSON object/list or whether the plain object should be returned. The later is required for writing an inner value- Returns:
- the extracted object
- Throws:
AttributeNotFoundExceptionIndexOutOfBoundsException- if an index is used which points outside the given list
-
setObjectValue
public Object setObjectValue(StringToObjectConverter pConverter, Object pInner, String pIndex, Object pValue) throws IllegalAccessException, InvocationTargetException Set a value in an array- Specified by:
setObjectValuein interfaceExtractor- Parameters:
pConverter- the global converter in order to be able do dispatch for serializing inner data typespInner- object on which to set the value (which must be aList)pIndex- index (as string) where to set the value within the arraypValue- the new value to set- Returns:
- the old value at this index
- Throws:
IllegalAccessExceptionInvocationTargetException
-
canSetValue
public boolean canSetValue()Whether this extractor is able to set a value.- Specified by:
canSetValuein interfaceExtractor- Returns:
- true if this extractor can set a value, false otherwise.
-