Class JsonWriteContext

    • Field Detail

      • buffer

        protected java.lang.StringBuffer buffer
      • writeclass

        protected boolean writeclass
      • writeid

        protected boolean writeid
      • excludes

        protected java.util.Map<java.lang.Class<?>,​java.util.Set<java.lang.String>> excludes
      • objectcnt

        protected int objectcnt
      • knownobjects

        protected java.util.Map<java.lang.Object,​java.lang.Integer> knownobjects
      • rootobject

        protected java.lang.Object rootobject
      • currentinputobject

        protected java.lang.Object currentinputobject
      • usercontext

        protected java.lang.Object usercontext
    • Constructor Detail

      • JsonWriteContext

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

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

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

      • getRootObject

        public java.lang.Object getRootObject()
        Get the rootobject.
        Specified by:
        getRootObject in interface IRootObjectContext
        Returns:
        the rootobject.
      • write

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

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

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

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

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

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

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

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

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

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

        public java.lang.String getString()
      • isWriteClass

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

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

        public java.lang.Object getUserContext()
        Returns the user context.
        Specified by:
        getUserContext in interface IUserContextContainer
        Returns:
        The user context.
      • setUserContext

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

        public void addObject​(java.lang.Object obj)
      • getObjectId

        public java.lang.Integer getObjectId​(java.lang.Object object)
      • incObjectCount

        public void incObjectCount()
      • isPropertyExcluded

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

        public java.lang.Object getCurrentInputObject()
        Returns:
        the currentinputobject
      • setCurrentInputObject

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

        public static java.lang.String encodeJsonString​(java.lang.String string)