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 classTry.style monad for stateful write to the write context, handling first writes specially. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringBufferprotected Objectprotected intprotected Objectprotected Objectprotected booleanprotected 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 TypeMethodDescriptionvoidstatic StringencodeJsonString(String string) getObjectId(Object object) Get the rootobject.Returns the user context.voidbooleanisPropertyExcluded(Class<?> clazz, String name) Test if a property should be excluded from serialization.booleanGet the writeclass.booleanGet the writeid.voidsetCurrentInputObject(Object currentinputobject) Sets the currentinputobject.voidsetUserContext(Object usercontext) Sets the user context.Write a string to the buffer.voidwriteClass(Class<?> clazz) Write the classname.voidwriteId()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:
getRootObjectin 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:
getUserContextin 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
-