public class

GenericJsonGenerator

extends Object
java.lang.Object
   ↳ com.microstrategy.utils.GenericJsonGenerator
Known Direct Subclasses

Class Overview

This class generates JavaScript Object Notation strings (JSON)

Summary

Public Constructors
GenericJsonGenerator()
The default, no args constructor.
GenericJsonGenerator(Comparator<String> keyComparator)
A constructor that passes in a Comparator to use for sorting properties.
GenericJsonGenerator(boolean preserveOrder)
A constructor used if caller needs the properties insertion order to be preserved
Public Methods
static String applyGenericEncoding(String data)
Set<String> getKeys()
void serializeInto(StringBuilder stringBuilder)
Serialize the contents of this object into the supplied StringBuilder, growing it first, as necessary, to accommodate the serialized form.
void setBeanPaths(WebComponent wc, int[] events)
Sets bean paths as properties of this Json
void setEncoderChain(ContentEncoderChain encoderChain)
void setJSObjectProperty(String propName, String propValue)
This method adds a JavaScript Object property to the bone
void setProperty(String propName, int propValue)
This method adds an integer property to the bone
void setProperty(String propName, String propValue, boolean quote)
This method adds a String property to the bone
void setProperty(String propName, GenericJsonGenerator[][] propValue)
void setProperty(String propName, int[] propValue)
This method adds an integers array property to the bone.
void setProperty(String propName, String propValue)
This method adds a String property to the bone
void setProperty(String propName, float propValue)
This method adds a float property to the bone
void setProperty(String propName, String[] propValue)
This method adds a String array property to the bone
void setProperty(String propName, double propValue)
This method adds a double property to the bone
void setProperty(String propName, GenericJsonGenerator[] propValue)
void setProperty(String propName, boolean propValue)
This method adds a boolean property to the bone
void setProperty(String propName, GenericJsonGenerator propValue)
This method adds a JSON property to the bone
int size()
String toString()
This method is deprecated. Inefficient--it is preferable to serialize the contents of this object into an existing StringBuilder instance. Use serializeInto(StringBuilder) instead.
String toStringStart()
This method builds part of the JSON string that represents this object the string outcome include the starting bracket and all the properties this object holds without the ending bracket.
Protected Methods
void addProperty(String propName, String propValue, boolean encodeName)
void addProperty(String propName, String propValue)
String encodeData(String data)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public GenericJsonGenerator ()

The default, no args constructor.

public GenericJsonGenerator (Comparator<String> keyComparator)

A constructor that passes in a Comparator to use for sorting properties.

Parameters
keyComparator The Comparator to use for ordering the keys in the map. If null, then no ordering is guaranteed.

public GenericJsonGenerator (boolean preserveOrder)

A constructor used if caller needs the properties insertion order to be preserved

Parameters
preserveOrder whether to preserve the insertion order.

Public Methods

public static String applyGenericEncoding (String data)

public Set<String> getKeys ()

public void serializeInto (StringBuilder stringBuilder)

Serialize the contents of this object into the supplied StringBuilder, growing it first, as necessary, to accommodate the serialized form.

Parameters
stringBuilder The StringBuilder to serialize into.

public void setBeanPaths (WebComponent wc, int[] events)

Sets bean paths as properties of this Json

Parameters
wc the web component that will be used to resolve the bean events.
events an array of event codes

public void setEncoderChain (ContentEncoderChain encoderChain)

public void setJSObjectProperty (String propName, String propValue)

This method adds a JavaScript Object property to the bone

Parameters
propName String the name of the property
propValue String the value of the property, that when parsed by the browser will evaluate into a JavaScript object

public void setProperty (String propName, int propValue)

This method adds an integer property to the bone

Parameters
propName String the name of the property
propValue int the value of the property

public void setProperty (String propName, String propValue, boolean quote)

This method adds a String property to the bone

Parameters
propName String the name of the property
propValue String the value of the property
quote If 'true', then encode the data in the string and quote it (with a single quote).

public void setProperty (String propName, GenericJsonGenerator[][] propValue)

public void setProperty (String propName, int[] propValue)

This method adds an integers array property to the bone.

Parameters
propName String the name of the property
propValue String the value of the property

public void setProperty (String propName, String propValue)

This method adds a String property to the bone

Parameters
propName String the name of the property
propValue String the value of the property

public void setProperty (String propName, float propValue)

This method adds a float property to the bone

Parameters
propName String the name of the property
propValue float the value of the property

public void setProperty (String propName, String[] propValue)

This method adds a String array property to the bone

Parameters
propName String the name of the property
propValue String the value of the property

public void setProperty (String propName, double propValue)

This method adds a double property to the bone

Parameters
propName String the name of the property
propValue double the value of the property

public void setProperty (String propName, GenericJsonGenerator[] propValue)

public void setProperty (String propName, boolean propValue)

This method adds a boolean property to the bone

Parameters
propName String the name of the property
propValue boolean the value of the property

public void setProperty (String propName, GenericJsonGenerator propValue)

This method adds a JSON property to the bone

Parameters
propName String the name of the property
propValue the value of the property

public int size ()

Returns
  • int the number of properties this object has set

public String toString ()

This method is deprecated.
Inefficient--it is preferable to serialize the contents of this object into an existing StringBuilder instance. Use serializeInto(StringBuilder) instead.

This method builds the JSON string that represents this object

Returns
  • String JSON

public String toStringStart ()

This method builds part of the JSON string that represents this object the string outcome include the starting bracket and all the properties this object holds without the ending bracket.

Returns
  • String JSON piece

Protected Methods

protected void addProperty (String propName, String propValue, boolean encodeName)

protected void addProperty (String propName, String propValue)

protected String encodeData (String data)