Class JsonOptionalProcessor
- java.lang.Object
-
- jadex.transformation.jsonserializer.processors.AbstractJsonProcessor
-
- jadex.transformation.jsonserializer.processors.JsonOptionalProcessor
-
- All Implemented Interfaces:
ITraverseProcessor
public class JsonOptionalProcessor extends AbstractJsonProcessor
java.util.Optional processor for reading json objects.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.reflect.Method
emptyMethod
Cached Method.protected java.lang.reflect.Method
getMethod
Cached Method.protected IBeanIntrospector
intro
Bean introspector for inspecting beans.protected java.lang.reflect.Method
isPresentMethod
Cached Method.protected java.lang.reflect.Method
ofMethod
Cached Method.protected static java.lang.String
OPTIONAL_CLASSNAME
Name of the java 8 optional class.protected java.lang.Class<?>
optionalClass
Cached Class.
-
Constructor Summary
Constructors Constructor Description JsonOptionalProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
init()
Init caches if not initialized.protected boolean
isApplicable(java.lang.Object object, java.lang.reflect.Type type, java.lang.ClassLoader targetcl, JsonReadContext context)
Test if the processor is applicable.protected boolean
isApplicable(java.lang.Object object, java.lang.reflect.Type type, java.lang.ClassLoader targetcl, JsonWriteContext context)
Test if the processor is applicable.protected java.lang.Object
readObject(java.lang.Object object, java.lang.reflect.Type type, Traverser traverser, java.util.List<ITraverseProcessor> conversionprocessors, java.util.List<ITraverseProcessor> processors, Traverser.MODE mode, java.lang.ClassLoader targetcl, JsonReadContext context)
Process an object.protected java.lang.Object
writeObject(java.lang.Object object, java.lang.reflect.Type type, Traverser traverser, java.util.List<ITraverseProcessor> conversionprocessors, java.util.List<ITraverseProcessor> processors, Traverser.MODE mode, java.lang.ClassLoader targetcl, JsonWriteContext wr)
Process an object.-
Methods inherited from class jadex.transformation.jsonserializer.processors.AbstractJsonProcessor
isApplicable, process
-
-
-
-
Field Detail
-
intro
protected IBeanIntrospector intro
Bean introspector for inspecting beans.
-
OPTIONAL_CLASSNAME
protected static final java.lang.String OPTIONAL_CLASSNAME
Name of the java 8 optional class.- See Also:
- Constant Field Values
-
optionalClass
protected java.lang.Class<?> optionalClass
Cached Class.
-
ofMethod
protected java.lang.reflect.Method ofMethod
Cached Method.
-
emptyMethod
protected java.lang.reflect.Method emptyMethod
Cached Method.
-
getMethod
protected java.lang.reflect.Method getMethod
Cached Method.
-
isPresentMethod
protected java.lang.reflect.Method isPresentMethod
Cached Method.
-
-
Method Detail
-
init
protected void init()
Init caches if not initialized.
-
isApplicable
protected boolean isApplicable(java.lang.Object object, java.lang.reflect.Type type, java.lang.ClassLoader targetcl, JsonReadContext context)
Test if the processor is applicable.- Specified by:
isApplicable
in classAbstractJsonProcessor
- Parameters:
object
- The object.targetcl
- If not null, the traverser should make sure that the result object is compatible with the class loader, e.g. by cloning the object using the class loaded from the target class loader.- Returns:
- True, if is applicable.
-
isApplicable
protected boolean isApplicable(java.lang.Object object, java.lang.reflect.Type type, java.lang.ClassLoader targetcl, JsonWriteContext context)
Test if the processor is applicable.- Specified by:
isApplicable
in classAbstractJsonProcessor
- Parameters:
object
- The object.targetcl
- If not null, the traverser should make sure that the result object is compatible with the class loader, e.g. by cloning the object using the class loaded from the target class loader.- Returns:
- True, if is applicable.
-
readObject
protected java.lang.Object readObject(java.lang.Object object, java.lang.reflect.Type type, Traverser traverser, java.util.List<ITraverseProcessor> conversionprocessors, java.util.List<ITraverseProcessor> processors, Traverser.MODE mode, java.lang.ClassLoader targetcl, JsonReadContext context)
Process an object.- Specified by:
readObject
in classAbstractJsonProcessor
- Parameters:
object
- The object.targetcl
- If not null, the traverser should make sure that the result object is compatible with the class loader, e.g. by cloning the object using the class loaded from the target class loader.- Returns:
- The processed object.
-
writeObject
protected java.lang.Object writeObject(java.lang.Object object, java.lang.reflect.Type type, Traverser traverser, java.util.List<ITraverseProcessor> conversionprocessors, java.util.List<ITraverseProcessor> processors, Traverser.MODE mode, java.lang.ClassLoader targetcl, JsonWriteContext wr)
Process an object.- Specified by:
writeObject
in classAbstractJsonProcessor
- Parameters:
object
- The object.targetcl
- If not null, the traverser should make sure that the result object is compatible with the class loader, e.g. by cloning the object using the class loaded from the target class loader.- Returns:
- The processed object.
-
-