Class ListExtractor

java.lang.Object
org.jolokia.service.serializer.json.ListExtractor
All Implemented Interfaces:
Extractor

public class ListExtractor extends Object implements Extractor
Extract a List
Since:
Apr 19, 2009
Author:
roland
  • Constructor Details

    • ListExtractor

      public ListExtractor()
  • Method Details

    • getType

      public Class<?> getType()
      Type for which this extractor can objects of this type
      Specified by:
      getType in interface Extractor
      Returns:
      type which can be handled
    • 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 an JSONArray. An index can be used (on top of the extra args stack) in order to specify a single value within the list.
      Specified by:
      extractObject in interface Extractor
      Parameters:
      pConverter - the global converter in order to be able do dispatch for serializing inner data types
      pValue - the value to convert (must be a List)
      pPathParts - extra arguments stack, which is popped to get an index for extracting a single element of the list
      jsonify - 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:
      AttributeNotFoundException
      IndexOutOfBoundsException - 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:
      setObjectValue in interface Extractor
      Parameters:
      pConverter - the global converter in order to be able do dispatch for serializing inner data types
      pInner - object on which to set the value (which must be a List)
      pIndex - index (as string) where to set the value within the list
      pValue - the new value to set
      Returns:
      the old value at this index
      Throws:
      IllegalAccessException
      InvocationTargetException
    • canSetValue

      public boolean canSetValue()
      Whether this extractor is able to set a value.
      Specified by:
      canSetValue in interface Extractor
      Returns:
      true if this extractor can set a value, false otherwise.