com.google.visualization.datasource.render
Class JsonRenderer

java.lang.Object
  extended by com.google.visualization.datasource.render.JsonRenderer

public class JsonRenderer
extends java.lang.Object

Takes a data table and returns a json string.

Author:
Nimrod T.

Method Summary
static java.lang.StringBuilder appendCellJson(TableCell cell, java.lang.StringBuilder sb, boolean includeFormatting, boolean isLastColumn)
          Appends a Json representing a cell to the string buffer.
static java.lang.StringBuilder appendColumnDescriptionJson(ColumnDescription col, java.lang.StringBuilder sb)
          Appends a Json representing a column description to the string buffer.
static java.lang.String getSignature(DataTable data)
          Returns a String-form 32-bit hash of this table's json.
static java.lang.CharSequence renderDataTable(DataTable dataTable, boolean includeValues, boolean includeFormatting)
          Generates a JSON representation of the data table object.
static java.lang.CharSequence renderJsonResponse(DataSourceParameters dsParams, ResponseStatus responseStatus, DataTable data, boolean isJsonp)
          Returns the json response for the given data table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSignature

public static java.lang.String getSignature(DataTable data)
Returns a String-form 32-bit hash of this table's json. Note: the signature ignores formatting.

Parameters:
data - The data table.
Returns:
a String-form 64-bit hash of this table.

renderJsonResponse

public static java.lang.CharSequence renderJsonResponse(DataSourceParameters dsParams,
                                                        ResponseStatus responseStatus,
                                                        DataTable data,
                                                        boolean isJsonp)
Returns the json response for the given data table.

Parameters:
dsParams - The datasource parameters.
responseStatus - The response status.
data - The data table.
Returns:
The json response for the given data table and parameters.

renderDataTable

public static java.lang.CharSequence renderDataTable(DataTable dataTable,
                                                     boolean includeValues,
                                                     boolean includeFormatting)
Generates a JSON representation of the data table object.

Parameters:
includeValues - False if the json should contain just meta-data and column descriptions but without the data rows.
includeFormatting - False if formatting information should be omitted from the generated json.
Returns:
The char sequence with the Json string.

appendCellJson

public static java.lang.StringBuilder appendCellJson(TableCell cell,
                                                     java.lang.StringBuilder sb,
                                                     boolean includeFormatting,
                                                     boolean isLastColumn)
Appends a Json representing a cell to the string buffer.

Parameters:
cell - The cell to write Json for.
sb - The string buffer to append to.
includeFormatting - Flase if formatting information should be omitted from the json.
isLastColumn - Is this the last column in the row.
Returns:
The input string builder.

appendColumnDescriptionJson

public static java.lang.StringBuilder appendColumnDescriptionJson(ColumnDescription col,
                                                                  java.lang.StringBuilder sb)
Appends a Json representing a column description to the string buffer.

Parameters:
col - The column description to write Json for.
sb - The string builder to append to.
Returns:
The input string builder.


Copyright © 2009 Google. All Rights Reserved.