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
  • Field Details

    • buffer

      protected StringBuffer buffer
    • writeclass

      protected boolean writeclass
    • writeid

      protected boolean writeid
    • excludes

      protected Map<Class<?>,Set<String>> excludes
    • objectcnt

      protected int objectcnt
    • knownobjects

      protected Map<Object,Integer> knownobjects
    • rootobject

      protected Object rootobject
    • currentinputobject

      protected Object currentinputobject
    • usercontext

      protected Object usercontext
  • Constructor Details

    • JsonWriteContext

      public JsonWriteContext(boolean writeclass)
      Create a new write context.
    • JsonWriteContext

      public JsonWriteContext(boolean writeclass, Map<Class<?>,Set<String>> excludes)
      Create a new write context.
    • JsonWriteContext

      public JsonWriteContext(boolean writeclass, boolean writeid, Map<Class<?>,Set<String>> excludes)
      Create a new write context.
  • Method Details

    • getRootObject

      public Object getRootObject()
      Get the rootobject.
      Specified by:
      getRootObject in interface jadex.common.transformation.traverser.IRootObjectContext
      Returns:
      the rootobject.
    • write

      public JsonWriteContext write(String str)
      Write a string to the buffer.
    • writeString

      public JsonWriteContext writeString(String str)
      Write a string to the buffer.
    • writeNameString

      public JsonWriteContext writeNameString(String name, String str)
      Write a string to the buffer.
    • writeNameValue

      public JsonWriteContext writeNameValue(String name, Object val)
      Write a string to the buffer.
    • writeNameValue

      public JsonWriteContext writeNameValue(String name, int val)
      Write a string to the buffer.
    • writeNameValue

      public JsonWriteContext writeNameValue(String name, long val)
      Write a string to the buffer.
    • writeNameValue

      public JsonWriteContext writeNameValue(String name, boolean val)
      Write a string to the buffer.
    • writeNameValue

      public JsonWriteContext writeNameValue(String name, Class<?> val)
      Write a string to the buffer.
    • writeClass

      public void writeClass(Class<?> clazz)
      Write the classname.
      Parameters:
      object -
    • writeId

      public void writeId()
      Write the classname.
      Parameters:
      object -
    • getString

      public String getString()
    • isWriteClass

      public boolean isWriteClass()
      Get the writeclass.
      Returns:
      The writeclass
    • isWriteId

      public boolean isWriteId()
      Get the writeid.
      Returns:
      The writeid
    • getUserContext

      public Object getUserContext()
      Returns the user context.
      Specified by:
      getUserContext in interface jadex.common.transformation.traverser.IUserContextContainer
      Returns:
      The user context.
    • setUserContext

      public void setUserContext(Object usercontext)
      Sets the user context.
      Parameters:
      usercontext - The user context.
    • addObject

      public void addObject(Object obj)
    • getObjectId

      public Integer getObjectId(Object object)
    • incObjectCount

      public void incObjectCount()
    • isPropertyExcluded

      public boolean isPropertyExcluded(Class<?> clazz, String name)
      Test if a property should be excluded from serialization.
    • getCurrentInputObject

      public Object getCurrentInputObject()
      Returns:
      the currentinputobject
    • setCurrentInputObject

      public void setCurrentInputObject(Object currentinputobject)
      Sets the currentinputobject.
      Parameters:
      currentinputobject - The currentinputobject to set
    • encodeJsonString

      public static String encodeJsonString(String string)