Class DateExtractor
java.lang.Object
org.jolokia.service.serializer.json.DateExtractor
- All Implemented Interfaces:
Extractor
Extractor for sophisticated date handling which support virtual
path handling (i.e for converting to epoch time or an ISO-8601 format)
- Since:
- 17.04.11
- Author:
- roland
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SimpleDateFormatprotected booleanprotected booleanprotected boolean -
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 object from pValue.Class<?>getType()Type for which this extractor can objects of this typesetObjectValue(StringToObjectConverter pConverter, Object pInner, String pAttribute, Object pValue) If this extractor is able to set a value (seeExtractor.canSetValue()), this method sets the value even on an inner object
-
Field Details
-
dateFormat
-
useUnixTimestamp
protected boolean useUnixTimestamp -
useUnixMillis
protected boolean useUnixMillis -
useUnixNanos
protected boolean useUnixNanos
-
-
Constructor Details
-
DateExtractor
-
-
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 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:
extractObjectin interfaceExtractor- Parameters:
pConverter- the global converter in order to be able do dispatch for serializing inner data typespValue- the value to convertpPathParts- extra arguments which contain e.g. a pathjsonify- 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 If this extractor is able to set a value (seeExtractor.canSetValue()), this method sets the value even on an inner object- 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 valuepAttribute- attribute of the object to setpValue- the new value to set- Returns:
- the old value
- Throws:
IllegalAccessException- if the attribute to set to is not accessibleInvocationTargetException- reflection error
-
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.
-