public class SelectItem extends BaseObject implements QueryItem, Cloneable
SelectClause,
Serialized Form| Constructor and Description |
|---|
SelectItem(Column column)
Creates a simple SelectItem that selects from a column
|
SelectItem(Column column,
FromItem fromItem)
Creates a SelectItem that references a column from a particular
FromItem, for example a.price or p.age |
SelectItem(FunctionType function,
Column column)
Creates a SelectItem that uses a function on a column, for example
SUM(price) or MAX(age)
|
SelectItem(FunctionType function,
Column column,
FromItem fromItem)
Creates a SelectItem that uses a function on a column from a particular
FromItem, for example SUM(a.price) or MAX(p.age) |
SelectItem(FunctionType function,
String expression,
String alias)
Creates a SelectItem based on a function and an expression.
|
SelectItem(SelectItem subQuerySelectItem,
FromItem subQueryFromItem)
Creates a SelectItem that references another select item in a subquery
|
SelectItem(String expression,
String alias)
Creates a SelectItem based on an expression.
|
| Modifier and Type | Method and Description |
|---|---|
protected SelectItem |
clone() |
protected void |
decorateIdentity(List<Object> identifiers)
Subclasses should implement this method and add all fields to the list
that are to be included in equals(...) and hashCode() evaluation
|
boolean |
equalsIgnoreAlias(SelectItem that) |
boolean |
equalsIgnoreAlias(SelectItem that,
boolean exactColumnCompare) |
AggregateFunction |
getAggregateFunction() |
String |
getAlias() |
Column |
getColumn() |
static SelectItem |
getCountAllItem()
Generates a COUNT(*) select item
|
ColumnType |
getExpectedColumnType()
Tries to infer the
ColumnType of this SelectItem. |
String |
getExpression() |
FromItem |
getFromItem() |
FunctionType |
getFunction()
Deprecated.
use
getAggregateFunction() or
getScalarFunction() instead |
Query |
getQuery() |
String |
getSameQueryAlias() |
String |
getSameQueryAlias(boolean includeSchemaInColumnPath) |
ScalarFunction |
getScalarFunction() |
FromItem |
getSubQueryFromItem()
Deprecated.
use
getFromItem() instead |
SelectItem |
getSubQuerySelectItem() |
String |
getSuperQueryAlias() |
String |
getSuperQueryAlias(boolean includeQuotes) |
static boolean |
isCountAllItem(SelectItem item) |
boolean |
isFunctionApproximationAllowed() |
boolean |
isReferenced(Column column)
Investigates whether or not this SelectItem references a particular
column.
|
SelectItem |
replaceFunction(FunctionType function)
Creates a copy of the
SelectItem, with a different
FunctionType. |
SelectItem |
setAlias(String alias) |
void |
setFunctionApproximationAllowed(boolean functionApproximationAllowed) |
SelectItem |
setQuery(Query query) |
String |
toSql() |
String |
toSql(boolean includeSchemaInColumnPath) |
String |
toString() |
StringBuilder |
toStringNoAlias() |
StringBuilder |
toStringNoAlias(boolean includeSchemaInColumnPath) |
classEquals, equals, hashCodepublic SelectItem(Column column)
column - public SelectItem(FunctionType function, Column column)
function - column - public SelectItem(Column column, FromItem fromItem)
FromItem, for example a.price or p.agecolumn - fromItem - public SelectItem(FunctionType function, Column column, FromItem fromItem)
FromItem, for example SUM(a.price) or MAX(p.age)function - column - fromItem - public SelectItem(String expression, String alias)
expression - alias - public SelectItem(FunctionType function, String expression, String alias)
function - expression - alias - public SelectItem(SelectItem subQuerySelectItem, FromItem subQueryFromItem)
subQuerySelectItem - subQueryFromItem - the FromItem that holds the sub-querypublic static SelectItem getCountAllItem()
public static boolean isCountAllItem(SelectItem item)
public String getAlias()
public SelectItem setAlias(String alias)
@Deprecated public FunctionType getFunction()
public AggregateFunction getAggregateFunction()
public ScalarFunction getScalarFunction()
public boolean isFunctionApproximationAllowed()
public void setFunctionApproximationAllowed(boolean functionApproximationAllowed)
public Column getColumn()
public ColumnType getExpectedColumnType()
ColumnType of this SelectItem. For
expression based select items, this is not possible, and the method will
return null.public String getExpression()
public SelectItem setQuery(Query query)
public SelectItem getSubQuerySelectItem()
@Deprecated public FromItem getSubQueryFromItem()
getFromItem() insteadpublic FromItem getFromItem()
public String getSuperQueryAlias()
public String getSuperQueryAlias(boolean includeQuotes)
includeQuotes - indicates whether or not the output should include quotes, if
the select item's column has quotes associated (typically
true, but false if used for presentation)public String getSameQueryAlias()
public String getSameQueryAlias(boolean includeSchemaInColumnPath)
public String toSql(boolean includeSchemaInColumnPath)
public StringBuilder toStringNoAlias()
public StringBuilder toStringNoAlias(boolean includeSchemaInColumnPath)
public boolean equalsIgnoreAlias(SelectItem that)
public boolean equalsIgnoreAlias(SelectItem that, boolean exactColumnCompare)
protected void decorateIdentity(List<Object> identifiers)
BaseObjectdecorateIdentity in class BaseObjectprotected SelectItem clone()
public SelectItem replaceFunction(FunctionType function)
SelectItem, with a different
FunctionType.function - public boolean isReferenced(Column column)
column - public String toString()
toString in interface QueryItemtoString in class BaseObjectCopyright © 2007–2015 The Apache Software Foundation. All rights reserved.