public abstract class SimplifierExtractor<T> extends Object implements Extractor
Extractor which
condense full blown Java beans (like File) to a more compact representation.
Simplifier extractors cannot be written to and are only used for downstream serialization.
Simplifier are registered by listing the classes in a META-INF/simplifiers plain text file and
then picked up by the converter. The default simplifiers coming prepackaged are taken from
META-INF/simplifiers-default| Modifier and Type | Class and Description |
|---|---|
static interface |
SimplifierExtractor.AttributeExtractor<T>
Helper interface for extracting and simplifying values
|
| Modifier | Constructor and Description |
|---|---|
protected |
SimplifierExtractor(Class<T> pType)
Super constructor taking the value type as argument
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addExtractor(String pName,
SimplifierExtractor.AttributeExtractor<T> pExtractor)
Add a single extractor
|
protected void |
addExtractors(Object[][] pAttrExtractors)
Add given extractors to the map.
|
boolean |
canSetValue()
No setting for simplifying extractors
|
Object |
extractObject(ObjectToJsonConverter pConverter,
Object pValue,
Stack<String> pPathParts,
boolean jsonify)
Extract an object from pValue.
|
Class |
getType()
Type for which this extractor can objects of this type
|
Object |
setObjectValue(StringToObjectConverter pConverter,
Object pInner,
String pAttribute,
Object pValue)
Throws always
IllegalArgumentException since a simplifier cannot be written to |
public Class getType()
public Object extractObject(ObjectToJsonConverter pConverter, Object pValue, Stack<String> pPathParts, boolean jsonify) throws AttributeNotFoundException
extractObject in interface ExtractorpConverter - 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 valueAttributeNotFoundException - if the inner path does not exist.public boolean canSetValue()
canSetValue in interface Extractorfalsepublic Object setObjectValue(StringToObjectConverter pConverter, Object pInner, String pAttribute, Object pValue) throws IllegalAccessException, InvocationTargetException
IllegalArgumentException since a simplifier cannot be written tosetObjectValue in interface ExtractorpConverter - 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 setIllegalAccessException - if the attribute to set to is not accessibleInvocationTargetException - reflection errorprotected final void addExtractors(Object[][] pAttrExtractors)
pAttrExtractors - extractorsprotected final void addExtractor(String pName, SimplifierExtractor.AttributeExtractor<T> pExtractor)
pName - name of the extractorpExtractor - the extractor itselfCopyright © 2017. All rights reserved.