org.gcube.portlets.user.tdw.server.datasource.util
Class GridJSonBuilder

java.lang.Object
  extended by org.gcube.portlets.user.tdw.server.datasource.util.GridJSonBuilder
Direct Known Subclasses:
TableJSonBuilder

public class GridJSonBuilder
extends Object

Author:
"Federico De Faveri defaveri@isti.cnr.it"

Nested Class Summary
protected static class GridJSonBuilder.JGridSonWriterState
           
 
Field Summary
protected  int fieldsCount
           
protected  boolean firstColumn
           
protected  boolean firstField
           
protected  boolean firstRow
           
protected  StringBuilder json
           
protected  boolean offsetDeclared
           
protected  int rowsCount
           
protected  boolean rowsDeclared
           
protected  GridJSonBuilder.JGridSonWriterState state
           
protected  boolean totalLengthDeclared
           
 
Constructor Summary
GridJSonBuilder()
           
 
Method Summary
protected  void addKey(String key)
           
 void addValue(String id, Boolean value)
          Adds a new value in the row.
 void addValue(String id, Date value)
          Adds a new value in the row.
 void addValue(String id, Double value)
          Adds a new value in the row.
 void addValue(String id, Float value)
          Adds a new value in the row.
 void addValue(String id, Integer value)
          Adds a new value in the row.
 void addValue(String id, Long value)
          Adds a new value in the row.
 void addValue(String id, String value)
          Adds a new value in the row.
protected  void addValueKey(String key)
           
protected  void appendQuoted(String value)
          Produce a string in double quotes with backslash sequences in all the right places.
protected  void checkFirstField()
           
protected  void checkState(GridJSonBuilder.JGridSonWriterState expectedState)
           
 void clean()
           
 void close()
           
 void endRow()
          Ends the data row.
 void endRows()
          Ends the data field.
protected  void resetState()
           
 void setOffset(String offsetField, int offset)
           
 void setTotalLength(String totalLengthField, int length)
          Set the total length field.
 void startRow()
          Starts a new data row.
 void startRows(String dataField)
          Starts the data field.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

state

protected GridJSonBuilder.JGridSonWriterState state

rowsDeclared

protected boolean rowsDeclared

totalLengthDeclared

protected boolean totalLengthDeclared

offsetDeclared

protected boolean offsetDeclared

json

protected StringBuilder json

firstField

protected boolean firstField

firstRow

protected boolean firstRow

firstColumn

protected boolean firstColumn

rowsCount

protected int rowsCount

fieldsCount

protected int fieldsCount
Constructor Detail

GridJSonBuilder

public GridJSonBuilder()
Method Detail

resetState

protected void resetState()

clean

public void clean()

checkState

protected void checkState(GridJSonBuilder.JGridSonWriterState expectedState)

checkFirstField

protected void checkFirstField()

startRows

public void startRows(String dataField)
Starts the data field.

Parameters:
dataField - the data field name.

startRow

public void startRow()
Starts a new data row.


addKey

protected void addKey(String key)

addValueKey

protected void addValueKey(String key)

addValue

public void addValue(String id,
                     Boolean value)
Adds a new value in the row.

Parameters:
id - the value id.
value - the value to insert.

addValue

public void addValue(String id,
                     Date value)
Adds a new value in the row.

Parameters:
id - the value id.
value - the value to insert.

addValue

public void addValue(String id,
                     Double value)
Adds a new value in the row.

Parameters:
id - the value id.
value - the value to insert.

addValue

public void addValue(String id,
                     Float value)
Adds a new value in the row.

Parameters:
id - the value id.
value - the value to insert.

addValue

public void addValue(String id,
                     Long value)
Adds a new value in the row.

Parameters:
id - the value id.
value - the value to insert.

addValue

public void addValue(String id,
                     Integer value)
Adds a new value in the row.

Parameters:
id - the value id.
value - the value to insert.

addValue

public void addValue(String id,
                     String value)
Adds a new value in the row.

Parameters:
id - the value id.
value - the value to insert.

endRow

public void endRow()
Ends the data row.


endRows

public void endRows()
Ends the data field.


setTotalLength

public void setTotalLength(String totalLengthField,
                           int length)
Set the total length field.

Parameters:
totalLengthField -
length -

setOffset

public void setOffset(String offsetField,
                      int offset)

close

public void close()

toString

public String toString()
Overrides:
toString in class Object

appendQuoted

protected void appendQuoted(String value)
Produce a string in double quotes with backslash sequences in all the right places. A backslash will be inserted within
Parameters:
value - A String


Copyright © 2013. All Rights Reserved.