Class TotalsTableBuilder
- All Implemented Interfaces:
- Serializable
@ScriptApi public class TotalsTableBuilder extends Object implements Serializable
The builder is intended to be passed to the Table.setTotalsTable(TotalsTableBuilder) operation after the
 operations are applied.
- See Also:
- Serialized Form
- 
Field SummaryFields Modifier and Type Field Description static longserialVersionUID
- 
Constructor SummaryConstructors Constructor Description TotalsTableBuilder()
- 
Method SummaryModifier and Type Method Description TotalsTableBuilderaddOperation(String column, AggType operation)Adds an operation for a column.TotalsTableBuilderaddOperation(String column, AggType operation, String format)Adds an operation for a column.TotalsTableBuilderaddOperation(String column, String operation)Adds an operation for a column.TotalsTableBuilderaddOperation(String column, String operation, String format)Adds an operation for a column.StringbuildDirective()Creates the string directive used to set the Table attribute.static TotalsTableBuilderfromDirective(String directive)Produce a TotalsTableBuilder from a directive string.static TotalsTableBuilderget(Table source)Produce a totals table builder from the source table.AggTypegetDefaultOperation()Gets the operation to use for columns without an operation specified.Map<AggType,String>getFormats(String column)Gets the format for an aggregated column.Set<AggType>getOperations(String column)Gets the operations for a given column.booleangetShowGrandTotalsByDefault()Should grand totals be shown by default?booleangetShowTotalsByDefault()Should totals be shown by default?static booleanhasDefinedTotals(Table source)Does a table have a totals table defined?static ComboAggregateFactorymakeAggregationFactory(Table source, TotalsTableBuilder builder)Produce a ComboAggregateFactory from a source table and builder.static TablemakeTotalsTable(Table source)Create a totals table from a source table.static TablemakeTotalsTable(Table source, TotalsTableBuilder builder, String... groupByColumns)Given a source table, builder and aggregation columns build a totals table with multiple rows.static booleanoperationApplies(Class type, AggType operation)Does the operation apply to type?TotalsTableBuildersetDefaultOperation(AggType defaultOperation)Sets the operation for columns which are not otherwise specified.TotalsTableBuildersetDefaultOperation(String defaultOperation)Sets the operation for columns which are not otherwise specified.TotalsTableBuildersetFormat(String column, AggType agg, String format)Sets the format of a column.TotalsTableBuildersetFormat(String column, String agg, String format)Sets the format of a column.TotalsTableBuildersetOperation(String column, AggType operation)Sets the operation for a column.TotalsTableBuildersetOperation(String column, AggType operation, String format)Sets the operation for a column.TotalsTableBuildersetOperation(String column, String operation)Sets the operation for a column.TotalsTableBuildersetOperation(String column, String operation, String format)Sets the operation for a column.TotalsTableBuildersetShowGrandTotalsByDefault(boolean showGrandTotalsByDefault)Set whether grand totals are shown by default.TotalsTableBuildersetShowTotalsByDefault(boolean showTotalsByDefault)Set whether totals are shown by default.StringtoString()
- 
Field Details- 
serialVersionUIDpublic static final long serialVersionUID- See Also:
- Constant Field Values
 
 
- 
- 
Constructor Details- 
TotalsTableBuilderpublic TotalsTableBuilder()
 
- 
- 
Method Details- 
getShowTotalsByDefaultpublic boolean getShowTotalsByDefault()Should totals be shown by default?- Returns:
- true if totals should be shown by default
 
- 
getShowGrandTotalsByDefaultpublic boolean getShowGrandTotalsByDefault()Should grand totals be shown by default?- Returns:
- true if grand totals should be shown by default
 
- 
setShowTotalsByDefaultSet whether totals are shown by default.- Parameters:
- showTotalsByDefault- whether totals are shown by default
- Returns:
- this TotalsTableBuilder
 
- 
setShowGrandTotalsByDefaultSet whether grand totals are shown by default.- Parameters:
- showGrandTotalsByDefault- whether grand totals are shown by default
- Returns:
- this TotalsTableBuilder
 
- 
setDefaultOperationSets the operation for columns which are not otherwise specified.- Parameters:
- defaultOperation- the default operation
- Returns:
- this TotalsTableBuilder
 
- 
setDefaultOperationSets the operation for columns which are not otherwise specified.- Parameters:
- defaultOperation- the default operation
- Returns:
- this TotalsTableBuilder
 
- 
setOperationSets the operation for a column.- Parameters:
- column- the name of the column to operate on
- operation- the aggregation operation for this column
- format- the format string for this column
- Returns:
- this TotalsTableBuilder
 
- 
setOperationSets the operation for a column.- Parameters:
- column- the name of the column to operate on
- operation- the aggregation operation for this column
- Returns:
- this TotalsTableBuilder
 
- 
setOperationSets the operation for a column.- Parameters:
- column- the name of the column to operate on
- operation- the aggregation operation for this column
- Returns:
- this TotalsTableBuilder
 
- 
setOperationSets the operation for a column.- Parameters:
- column- the name of the column to operate on
- operation- the aggregation operation for this column
- format- the format string for this column
- Returns:
- this TotalsTableBuilder
 
- 
addOperationAdds an operation for a column.The add method is used instead of the setOperation(String, String)method when more than one aggregation per input column is desired.- Parameters:
- column- the name of the column to operate on
- operation- the aggregation operation for this column
- Returns:
- this TotalsTableBuilder
 
- 
addOperationAdds an operation for a column.The add method is used instead of the setOperation(String, AggType, String)method when more than one aggregation per input column is desired.- Parameters:
- column- the name of the column to operate on
- operation- the aggregation operation for this column
- format- the format string for this column
- Returns:
- this TotalsTableBuilder
 
- 
addOperationAdds an operation for a column.The add method is used instead of the setOperation(String, String, String)method when more than one aggregation per input column is desired.- Parameters:
- column- the name of the column to operate on
- operation- the aggregation operation for this column
- format- the format string for this column
- Returns:
- this TotalsTableBuilder
 
- 
addOperationAdds an operation for a column.The add method is used instead of the setOperation(String, String)method when more than one aggregation per input column is desired.- Parameters:
- column- the name of the column to operate on
- operation- the aggregation operation for this column
- Returns:
- this TotalsTableBuilder
 
- 
getOperationsGets the operations for a given column.- Parameters:
- column- the column to get the operations for
- Returns:
- a set of aggregations for the column
 
- 
getDefaultOperationGets the operation to use for columns without an operation specified.- Returns:
- the default operation
 
- 
setFormatSets the format of a column.- Parameters:
- column- the column to set the format for
- agg- the aggregation type the format is relevant for
- format- the format string
- Returns:
- this TotalsTableBuilder
 
- 
setFormatSets the format of a column.- Parameters:
- column- the column to set the format for
- agg- the aggregation type the format is relevant for, "*" for all aggregations
- format- the format string
- Returns:
- this TotalsTableBuilder
 
- 
getFormatsGets the format for an aggregated column.- Parameters:
- column- the column to get the format for
- Returns:
- a map from AggType to the corresponding format string
 
- 
buildDirectiveCreates the string directive used to set the Table attribute.- Returns:
- the attribute string representing this TotalsTableBuilder.
 
- 
toString
- 
makeTotalsTableCreate a totals table from a source table.Given a source table that has had a TotalsTableBuilder applied, create a new totals table from the table. If no TotalsTableBuilder has been applied, then the columns are summed. - Parameters:
- source- the source table
- Returns:
- an aggregated totals table
 
- 
getProduce a totals table builder from the source table.- Parameters:
- source- the source table
- Returns:
- a TotalsTableBuilder derived from the source table's totals table attribute
 
- 
fromDirectiveProduce a TotalsTableBuilder from a directive string.The buildDirective()method produces a String representation of a TotalsTableBuilder, this function is its inverse.- Parameters:
- directive- the directive.
- Returns:
- a TotalsTableBuilder
 
- 
hasDefinedTotalsDoes a table have a totals table defined?- Parameters:
- source- the source table
- Returns:
- true if source has a totals table defined
 
- 
makeTotalsTablepublic static Table makeTotalsTable(Table source, TotalsTableBuilder builder, String... groupByColumns)Given a source table, builder and aggregation columns build a totals table with multiple rows.- Parameters:
- source- the source table
- builder- the TotalsTableBuilder
- groupByColumns- the columns to group by
- Returns:
- an aggregated totals table
 
- 
makeAggregationFactorypublic static ComboAggregateFactory makeAggregationFactory(Table source, TotalsTableBuilder builder)Produce a ComboAggregateFactory from a source table and builder.- Parameters:
- source- the source table
- builder- the TotalsTableBuilder
- Returns:
- the ComboAggregateFactorydescribed by source and builder.
 
- 
operationAppliesDoes the operation apply to type?- Parameters:
- type- the column type
- operation- the aggregation operation
- Returns:
- true if the operation is applicable to columns of this type
 
 
-