com.esri.gpt.server.usage.common
Class JSONWriter
java.lang.Object
com.esri.gpt.control.rest.writer.ResponseWriter
com.esri.gpt.control.rest.writer.ResultSetWriter
com.esri.gpt.control.rest.writer.JsonResultSetWriter
com.esri.gpt.server.usage.common.JSONWriter
- All Implemented Interfaces:
- IStatisticsWriter
public class JSONWriter
- extends JsonResultSetWriter
- implements IStatisticsWriter
This is class is used to write json response.
| Methods inherited from class com.esri.gpt.control.rest.writer.ResponseWriter |
begin, close, flush, getNewline, getTab, getUnderlyingWriter, makeTabs, setNewline, setTab, setUnderlyingWriter, wasWrittenTo, write |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JSONWriter
public JSONWriter(Writer underlyingWriter,
StringBuilder sb)
writeElement
public void writeElement(String key,
String value,
boolean hasMore,
boolean isNumber)
- Serializes key value pair to json object.
- Specified by:
writeElement in interface IStatisticsWriter
- Parameters:
key - the keyvalue - the valuehasMore - true if has more elements in an JSON arrayisNumber - true if value is number.
writeElement
public void writeElement(String name,
String value)
throws Exception
- Serializes key value pair to json object.
- Specified by:
writeElement in interface IStatisticsWriter
- Parameters:
name - the namevalue - the value
- Throws:
Exception - if writing element fails
writeResultSet
public void writeResultSet(String tableName,
ResultSet rs,
String[] columnTags)
throws Exception
- This method is used to serialize resultset rows as json.
- Specified by:
writeResultSet in interface IStatisticsWriter
- Parameters:
tableName - the tableName for which rows are serializedrs - the resultsetcolumnTags - the column names
- Throws:
Exception - if writing element fails
Copyright 2011 Environmental Systems Research Institute.
All rights reserved.
Use is subject to
license terms.