Class StringJsonBuilder

  • All Implemented Interfaces:
    JsonBuilder

    public class StringJsonBuilder
    extends java.lang.Object
    implements JsonBuilder
    A JSON builder that creates JSON strings
    Author:
    Michel Kraemer
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      JsonBuilder add​(java.lang.String name, java.lang.Object o)
      Adds a property to the object to build
      java.lang.String build()
      Builds the JSON object
      java.lang.Object toJson​(java.lang.Object arr)
      Converts the given object to a JSON object
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StringJsonBuilder

        public StringJsonBuilder​(JsonBuilderFactory factory)
        Creates a JSON builder
        Parameters:
        factory - the factory that created this builder
    • Method Detail

      • add

        public JsonBuilder add​(java.lang.String name,
                               java.lang.Object o)
        Description copied from interface: JsonBuilder
        Adds a property to the object to build
        Specified by:
        add in interface JsonBuilder
        Parameters:
        name - the property's name
        o - the property's value
        Returns:
        the JsonBuilder
      • build

        public java.lang.String build()
        Description copied from interface: JsonBuilder
        Builds the JSON object
        Specified by:
        build in interface JsonBuilder
        Returns:
        the object
      • toJson

        public java.lang.Object toJson​(java.lang.Object arr)
        Description copied from interface: JsonBuilder
        Converts the given object to a JSON object
        Specified by:
        toJson in interface JsonBuilder
        Parameters:
        arr - the object to convert
        Returns:
        the JSON object