Class ListExtractor
java.lang.Object
org.jolokia.service.serializer.json.ListExtractor
- All Implemented Interfaces:
Extractor
Extract a
List- 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 a list 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 within a list
-
Constructor Details
-
ListExtractor
public ListExtractor()
-
-
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 a list 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 list.- 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 aList)pPathParts- extra arguments stack, which is popped to get an index for extracting a single element of the listjsonify- 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 within a list- 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 listpValue- 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.
-