Class TemporalExtractor

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

public class TemporalExtractor extends Object implements Extractor
Extractor for implementations of Temporal, like:
  • Field Details

    • useUnixTimestamp

      protected boolean useUnixTimestamp
    • useUnixMillis

      protected boolean useUnixMillis
    • useUnixNanos

      protected boolean useUnixNanos
  • Constructor Details

    • TemporalExtractor

      public TemporalExtractor(String dateFormat, TimeZone timeZone)
  • Method Details

    • getType

      public Class<?> getType()
      Description copied from interface: Extractor
      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> pExtraArgs, boolean jsonify) throws AttributeNotFoundException
      Description copied from interface: Extractor
      Extract an object from pValue. In the simplest case, this is the value itself. For more complex data types, it is converted into a JSON structure if possible (and if 'jsonify' is true). pExtraArgs is not null, this returns only a substructure, specified by the path represented by this stack
      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
      pExtraArgs - extra arguments which contain e.g. a path
      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 - if the inner path does not exist.
    • setObjectValue

      public Object setObjectValue(StringToObjectConverter pConverter, Object pInner, String pAttribute, Object pValue) throws IllegalAccessException, InvocationTargetException, IllegalArgumentException
      Description copied from interface: Extractor
      If this extractor is able to set a value (see Extractor.canSetValue()), this method sets the value even on an inner object
      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
      pAttribute - attribute of the object to set
      pValue - the new value to set
      Returns:
      the old value
      Throws:
      IllegalAccessException - if the attribute to set to is not accessible
      InvocationTargetException - reflection error
      IllegalArgumentException - if the attribute can't be converted to desired value
    • canSetValue

      public boolean canSetValue()
      Description copied from interface: Extractor
      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.