Class JsonWriteContext
java.lang.Object
jadex.transformation.jsonserializer.processors.JsonWriteContext
- All Implemented Interfaces:
jadex.common.transformation.traverser.IRootObjectContext
,jadex.common.transformation.traverser.IUserContextContainer
public class JsonWriteContext
extends Object
implements jadex.common.transformation.traverser.IRootObjectContext
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Try.style monad for stateful write to the write context, handling first writes specially. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringBuffer
protected Object
protected int
protected Object
protected Object
protected boolean
protected boolean
-
Constructor Summary
ConstructorsConstructorDescriptionJsonWriteContext
(boolean writeclass) Create a new write context.JsonWriteContext
(boolean writeclass, boolean writeid, Map<Class<?>, Set<String>> excludes) Create a new write context.JsonWriteContext
(boolean writeclass, Map<Class<?>, Set<String>> excludes) Create a new write context. -
Method Summary
Modifier and TypeMethodDescriptionvoid
static String
encodeJsonString
(String string) getObjectId
(Object object) Get the rootobject.Returns the user context.void
boolean
isPropertyExcluded
(Class<?> clazz, String name) Test if a property should be excluded from serialization.boolean
Get the writeclass.boolean
Get the writeid.void
setCurrentInputObject
(Object currentinputobject) Sets the currentinputobject.void
setUserContext
(Object usercontext) Sets the user context.Write a string to the buffer.void
writeClass
(Class<?> clazz) Write the classname.void
writeId()
Write the classname.writeNameString
(String name, String str) Write a string to the buffer.writeNameValue
(String name, boolean val) Write a string to the buffer.writeNameValue
(String name, int val) Write a string to the buffer.writeNameValue
(String name, long val) Write a string to the buffer.writeNameValue
(String name, Class<?> val) Write a string to the buffer.writeNameValue
(String name, Object val) Write a string to the buffer.writeString
(String str) Write a string to the buffer.
-
Field Details
-
buffer
-
writeclass
protected boolean writeclass -
writeid
protected boolean writeid -
excludes
-
objectcnt
protected int objectcnt -
knownobjects
-
rootobject
-
currentinputobject
-
usercontext
-
-
Constructor Details
-
JsonWriteContext
public JsonWriteContext(boolean writeclass) Create a new write context. -
JsonWriteContext
Create a new write context. -
JsonWriteContext
Create a new write context.
-
-
Method Details
-
getRootObject
Get the rootobject.- Specified by:
getRootObject
in interfacejadex.common.transformation.traverser.IRootObjectContext
- Returns:
- the rootobject.
-
write
Write a string to the buffer. -
writeString
Write a string to the buffer. -
writeNameString
Write a string to the buffer. -
writeNameValue
Write a string to the buffer. -
writeNameValue
Write a string to the buffer. -
writeNameValue
Write a string to the buffer. -
writeNameValue
Write a string to the buffer. -
writeNameValue
Write a string to the buffer. -
writeClass
Write the classname.- Parameters:
object
-
-
writeId
public void writeId()Write the classname.- Parameters:
object
-
-
getString
-
isWriteClass
public boolean isWriteClass()Get the writeclass.- Returns:
- The writeclass
-
isWriteId
public boolean isWriteId()Get the writeid.- Returns:
- The writeid
-
getUserContext
Returns the user context.- Specified by:
getUserContext
in interfacejadex.common.transformation.traverser.IUserContextContainer
- Returns:
- The user context.
-
setUserContext
Sets the user context.- Parameters:
usercontext
- The user context.
-
addObject
-
getObjectId
-
incObjectCount
public void incObjectCount() -
isPropertyExcluded
Test if a property should be excluded from serialization. -
getCurrentInputObject
- Returns:
- the currentinputobject
-
setCurrentInputObject
Sets the currentinputobject.- Parameters:
currentinputobject
- The currentinputobject to set
-
encodeJsonString
-