com.google.visualization.datasource.query
Class QueryLabels

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

public class QueryLabels
extends java.lang.Object

Describes the labels of a Query, as passed in the query under the "label" clause. A label can optionally be specified for each column. If not specified, each column type has a default label.

Author:
Itai R.

Constructor Summary
QueryLabels()
          Default empty constructor, with no labels.
 
Method Summary
 void addLabel(AbstractColumn column, java.lang.String label)
          Adds a column label.
 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 columns for which a label was specified.
 java.lang.String getLabel(AbstractColumn column)
          Returns the label of the specified column, or null if no label 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 QueryLabels equal to this one.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryLabels

public QueryLabels()
Default empty constructor, with no labels. Labels can be added later.

Method Detail

addLabel

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

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

getLabel

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

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

getColumns

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

Returns:
An immutable set of the columns for which a label 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 QueryLabels equal to this one. The string returned does not contain the LABEL keyword.

Returns:
The query string.


Copyright © 2009 Google. All Rights Reserved.