com.google.visualization.datasource.query
Class QueryFormat

java.lang.Object
  extended by com.google.visualization.datasource.query.QueryFormat

public class QueryFormat
extends java.lang.Object

Describes the formatting options of a Query, as passed on the query in the "format" clause. Format can be specified for each column, but does not have to be. If not specified, each column type has a default format. Each format is a string pattern, as used in the ICU UFormat class.

Author:
Itai R.
See Also:
UFormat

Constructor Summary
QueryFormat()
          Default empty constructor, with no patterns (patterns can be added later).
 
Method Summary
 void addPattern(AbstractColumn column, java.lang.String pattern)
          Adds a column pattern.
 boolean equals(java.lang.Object obj)
           
 java.util.List<AggregationColumn> getAggregationColumns()
          Returns all the columns that are AggregationColumns.
 java.util.Set<AbstractColumn> getColumns()
          Returns an immutable set of the column IDs for which a pattern was specified.
 java.lang.String getPattern(AbstractColumn column)
          Returns the pattern of the specified column, or null if no pattern was specified.
 java.util.List<ScalarFunctionColumn> getScalarFunctionColumns()
          Returns all the columns that are ScalarFunctionColumns including scalar functions columns that are inside other scalar function columns (e.g., sum(year(a), year(b))).
 int hashCode()
           
 java.lang.String toQueryString()
          Returns a string that when fed into the query parser, produces a QueryFormat equal to this one.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryFormat

public QueryFormat()
Default empty constructor, with no patterns (patterns can be added later).

Method Detail

addPattern

public void addPattern(AbstractColumn column,
                       java.lang.String pattern)
                throws InvalidQueryException
Adds a column pattern. Validates that the column ID is not already specified.

Parameters:
column - The column to which the pattern is assigned.
pattern - The assigned pattern.
Throws:
InvalidQueryException - Thrown if the column is already specified.

getPattern

public java.lang.String getPattern(AbstractColumn column)
Returns the pattern of the specified column, or null if no pattern was specified.

Parameters:
column - The column for which the pattern is required.
Returns:
The pattern, or null if no pattern was specified for this column.

getColumns

public java.util.Set<AbstractColumn> getColumns()
Returns an immutable set of the column IDs for which a pattern was specified.

Returns:
An immutable set of the column IDs for which a pattern was specified.

getScalarFunctionColumns

public java.util.List<ScalarFunctionColumn> getScalarFunctionColumns()
Returns all the columns that are ScalarFunctionColumns including scalar functions columns that are inside other scalar function columns (e.g., sum(year(a), year(b))).

Returns:
all the columns that are ScalarFunctionColumns.

getAggregationColumns

public java.util.List<AggregationColumn> getAggregationColumns()
Returns all the columns that are AggregationColumns.

Returns:
All the columns that are AggregationColumns.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toQueryString

public java.lang.String toQueryString()
Returns a string that when fed into the query parser, produces a QueryFormat equal to this one. The string returned does not contain the FORMAT keyword.

Returns:
The query string.


Copyright © 2009 Google. All Rights Reserved.