Class JsonOptionalProcessor
java.lang.Object
jadex.transformation.jsonserializer.processors.AbstractJsonProcessor
jadex.transformation.jsonserializer.processors.JsonOptionalProcessor
- All Implemented Interfaces:
jadex.common.transformation.traverser.ITraverseProcessor
java.util.Optional processor for reading json objects.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Method
Cached Method.protected Method
Cached Method.protected jadex.common.transformation.traverser.IBeanIntrospector
Bean introspector for inspecting beans.protected Method
Cached Method.protected Method
Cached Method.protected static final String
Name of the java 8 optional class.protected Class
<?> Cached Class. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
init()
Init caches if not initialized.protected boolean
isApplicable
(Object object, Type type, ClassLoader targetcl, JsonReadContext context) Test if the processor is applicable.protected boolean
isApplicable
(Object object, Type type, ClassLoader targetcl, JsonWriteContext context) Test if the processor is applicable.protected Object
readObject
(Object object, Type type, jadex.common.transformation.traverser.Traverser traverser, List<jadex.common.transformation.traverser.ITraverseProcessor> conversionprocessors, List<jadex.common.transformation.traverser.ITraverseProcessor> processors, jadex.common.transformation.IStringConverter converter, jadex.common.transformation.traverser.Traverser.MODE mode, ClassLoader targetcl, JsonReadContext context) Process an object.protected Object
writeObject
(Object object, Type type, jadex.common.transformation.traverser.Traverser traverser, List<jadex.common.transformation.traverser.ITraverseProcessor> conversionprocessors, List<jadex.common.transformation.traverser.ITraverseProcessor> processors, jadex.common.transformation.IStringConverter converter, jadex.common.transformation.traverser.Traverser.MODE mode, ClassLoader targetcl, JsonWriteContext wr) Process an object.Methods inherited from class jadex.transformation.jsonserializer.processors.AbstractJsonProcessor
isApplicable, process
-
Field Details
-
intro
protected jadex.common.transformation.traverser.IBeanIntrospector introBean introspector for inspecting beans. -
OPTIONAL_CLASSNAME
Name of the java 8 optional class.- See Also:
-
optionalClass
Cached Class. -
ofMethod
Cached Method. -
emptyMethod
Cached Method. -
getMethod
Cached Method. -
isPresentMethod
Cached Method.
-
-
Constructor Details
-
JsonOptionalProcessor
public JsonOptionalProcessor()
-
-
Method Details
-
init
protected void init()Init caches if not initialized. -
isApplicable
protected boolean isApplicable(Object object, Type type, 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(Object object, Type type, 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 Object readObject(Object object, Type type, jadex.common.transformation.traverser.Traverser traverser, List<jadex.common.transformation.traverser.ITraverseProcessor> conversionprocessors, List<jadex.common.transformation.traverser.ITraverseProcessor> processors, jadex.common.transformation.IStringConverter converter, jadex.common.transformation.traverser.Traverser.MODE mode, 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 Object writeObject(Object object, Type type, jadex.common.transformation.traverser.Traverser traverser, List<jadex.common.transformation.traverser.ITraverseProcessor> conversionprocessors, List<jadex.common.transformation.traverser.ITraverseProcessor> processors, jadex.common.transformation.IStringConverter converter, jadex.common.transformation.traverser.Traverser.MODE mode, 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.
-