public abstract class DBColumnExpr extends DBExpr implements ColumnExpr
| Modifier and Type | Field and Description |
|---|---|
protected Attributes |
attributes |
protected String |
beanPropertyName |
protected Options |
options |
CTX_ALIAS, CTX_ALL, CTX_DEFAULT, CTX_FULLNAME, CTX_NAME, CTX_NOPARENTHESIS, CTX_VALUE| Constructor and Description |
|---|
DBColumnExpr() |
| Modifier and Type | Method and Description |
|---|---|
DBFuncExpr |
abs()
Creates and returns a sql-expression for the absolute abs() function.
|
abstract Element |
addXml(Element parent,
long flags)
Add a description of this column with relevant metadata
to the supplied parent XML Element.
|
DBColumnExpr |
aggregate(String template,
DataType returnType,
Object... params)
Creates and returns a function from an sql template
The template may consist of the following placeholders:
?
|
DBConcatExpr |
append(Object value)
Creates a new DBConcatExpr object with the specified value.
|
DBAliasExpr |
as(DBColumn column)
creates a new DBAliasExpr which renames the current expression to the name of the supplied column.
|
DBAliasExpr |
as(String alias)
creates a new DBAliasExpr which renames the current expression to the supplied name.
|
DBOrderByExpr |
asc()
creates a new DBOrderByExpr for ascending order
|
DBFuncExpr |
avg()
Creates and returns an aggregation function object
which returns the average value for the current expression over a group of rows.
|
DBFuncExpr |
ceiling()
Create and returns an expression for the SQL-function ceil()
|
DBCompareColExpr |
cmp(DBCmpType op,
Object value)
Creates and returns a new comparison object for the given comparison operator and value.
|
DBCoalesceExpr |
coalesce(Object nullValue)
Creates a sql-expression for the nvl() or coalesce() function.
|
DBConcatFuncExpr |
concat(DBColumnExpr... concatExprs)
concatenates a list of expressions to the current column
|
DBConcatFuncExpr |
concat(String separator,
DBColumnExpr... concatExprs)
concatenates a list of expressions to the current column
|
DBCompareColExpr |
contains(Object value)
Creates and returns a new comparison object for the "contains(column, val)" comparator
|
DBConvertExpr |
convertTo(DataType dataType)
Creates and returns a new DBFuncExpr object that will
convert the current column to the destination data type specified.
|
DBConvertExpr |
convertTo(DataType dataType,
Object format)
Creates a new DBFuncExpr object that will convert
the current column to the destination data type specified.
|
DBCountExpr |
count()
Creates and returns an expression for the SQL "count()" function
which returns the number of rows in the result set.
|
DBCountExpr |
countDistinct()
Creates and returns an expression for the SQL "count()" function
which returns the number of unique values in the result set.
|
DBFuncExpr |
day()
Creates and returns an function object that
calculates the day of a date value.
|
DBDecodeExpr |
decode(Map<?,?> valueMap,
Object otherwise)
Creates and returns a sql-expression that compares the current column expression with
a list of values and returns the corresponding alternative value.
|
DBDecodeExpr |
decode(Object key1,
Object value1,
Object otherwise) |
DBDecodeExpr |
decode(Object key1,
Object value1,
Object key2,
Object value2,
Object otherwise) |
DBDecodeExpr |
decode(Object key1,
Object value1,
Object key2,
Object value2,
Object key3,
Object value3,
Object otherwise) |
DBDecodeExpr |
decode(Options options) |
DBDecodeExpr |
decode(Options options,
Object otherwise) |
DBDecodeExpr |
decodeEnum(Class<? extends Enum<?>> enumType,
String otherwise)
Creates and returns a sql-expression that maps enum values by name or ordinal to their string representation
|
DBDecodeExpr |
decodeSort(Class<? extends Enum<?>> enumType,
boolean defaultToEnd)
Creates and returns a sql-expression that maps enum values from name to ordinal
This is useful for sorting.
|
DBOrderByExpr |
desc()
creates a new DBOrderByExpr for descending order
|
DBCalcExpr |
divideBy(Object value)
Creates and returns a new calculation object
for the SQL "/" (divide) operator.
|
DBFuncExpr |
floor()
Create and returns an expression for the SQL-function floor()
|
DBFuncExpr |
format(String format)
Formats a column-expression using a format string
This function is intended for formatting numbers.
|
DBColumnExpr |
function(String template,
DataType returnType,
Object... params)
Creates and returns a function from an sql template
The template may consist of the following placeholders:
?
|
Object |
getAttribute(String name)
Returns the value of a column attribute.
|
<T> T |
getAttribute(String name,
Class<T> type)
Returns the value of a column attribute and converts it to the desired type
|
String |
getBeanPropertyName()
Gets the Java bean property name for this column
i.e.
|
String |
getControlType()
Returns the column control type.
|
abstract DataType |
getDataType()
Returns the data type of this column expression.
|
boolean |
getDefaultSortOrder()
Returns the default sort order
FALSE is for ascending, TRUE for descending
|
protected DBFuncExpr |
getExprFromPhrase(DBSqlPhrase phrase,
Object[] params) |
protected DBFuncExpr |
getExprFromPhrase(DBSqlPhrase phrase,
Object[] params,
DataType dataType)
Creates a new DBFuncExpr from a given SQL-PRHASE and
optional additional parameters.
|
DBColumnExpr |
getIgnoreCaseExpr()
Returns an expression which ignores the case
Only for case sensitive columns!
|
Class<?> |
getJavaType()
returns a corresponding Java type for this expression
|
abstract String |
getName()
Returns the column name for this column expression.
|
String |
getNumberType(ColumnExpr columnExpr)
Returns the number type assigned to this column expression
|
Options |
getOptions()
Returns the list of options for this column
containing all possible field values.
|
abstract DBRowSet |
getRowSet()
Returns the underlying rowset containing this column
For functions involving none or more than one physical column this function return the first one
|
DBColumn |
getSourceColumn()
Deprecated.
|
String |
getTitle()
Returns the title attribute.
|
abstract DBColumn |
getUpdateColumn()
Returns the underlying physical column.
|
DBCompareColExpr |
in(Collection<?> values)
Creates and returns an expression for the SQL "in" operator.
|
DBCompareColExpr |
in(DBExpr expr)
Creates and returns an expression for the SQL "not in" operator.
|
<T> DBCompareColExpr |
in(T... values)
Creates and returns an expression for the SQL "in" operator.
|
DBFuncExpr |
indexOf(Object str)
Creates and returns a sql-expression that returns the position of a string in the current column expression.
|
DBFuncExpr |
indexOf(Object str,
DBExpr fromPos)
Creates and returns a sql-expression that returns the position of a string in the current column expression.
|
DBFuncExpr |
indexOf(Object str,
int fromPos)
Overloaded.
|
DBCompareColExpr |
is(Object value)
Creates and returns a new comparison object for the SQL "=" (equal) operator.
|
abstract boolean |
isAggregate()
Indicates whether this function is an aggregate (sum, min, max, avg, ...) or not
|
DBCompareColExpr |
isBetween(Object minValue,
Object maxValue)
Creates and returns a new comparison object
for the SQL "between" operator.
|
boolean |
isCaseSensitive()
Returns whether or not a columnExpr is case sensitive
If not explicitly set, the case sensitivity is true for all text fields (VARCHAR, CLOB) except if an EnumType is set.
|
DBCompareColExpr |
isGreaterThan(Object value)
Creates and returns a new comparison object
for the SQL ">" (greater than) operator.
|
DBCompareColExpr |
isLessOrEqual(Object value)
Creates and returns a new comparison object
for the SQL "<=" (less or equal) operator.
|
protected boolean |
isLiteralValue(Object value)
Checks if a value is a literal value
|
DBCompareColExpr |
isMoreOrEqual(Object value)
Creates and returns a new comparison object
for the SQL ">=" (greater or equal) operator.
|
DBCompareColExpr |
isNot(Object value)
Creates and returns a new comparison object
for the SQL "<>" (not equal) operator.
|
DBCompareColExpr |
isNotBetween(Object minValue,
Object maxValue)
Creates and returns a new comparison object
for the SQL "not between" operator.
|
DBCompareColExpr |
isSmallerThan(Object value)
Creates and returns a new comparison object
for the SQL "<" (less than) operator.
|
DBFuncExpr |
length()
Creates and returns a sql-expression that returns the string length of this expression.
|
DBCompareColExpr |
like(Object value)
Creates and returns a new comparison object for the SQL "like" operator.
|
DBCompareColExpr |
like(String value,
char escape)
Creates and returns a new comparison object for the SQL "like" operator.
|
DBCompareColExpr |
likeLower(String value)
Deprecated.
Always user likeUpper() for case insensitive comparisons
|
DBCompareColExpr |
likeUpper(String value)
Creates and returns a new case insensitive comparison for the SQL "like" operator.
|
DBFuncExpr |
lower()
Creates and returns a function object which
converts the current expression to lower case.
|
DBFuncExpr |
max()
Creates and returns an aggregation function object
which returns the maximum value for the current expression over a group of rows.
|
DBFuncExpr |
min()
Creates and returns an aggregation function object
which returns the minimum value for the current expression over a group of rows.
|
DBCalcExpr |
minus(int value)
Creates and returns a new calculation object
for either the SQL "+" (plus) or "-" (minus) operator
depending on whether the supplied integer value is negative or positive.
|
DBCalcExpr |
minus(Object value)
Creates and returns a new calculation object
for the SQL "-" (minus) operator.
|
DBFuncExpr |
modulo(Object divisor)
Creates a sql-expression for the modulo or mod() function.
|
DBFuncExpr |
month()
Creates and returns an function object that
calculates the month of a date value.
|
DBCalcExpr |
multiplyWith(Object value)
Creates and returns a new calculation object
for the SQL "*" (multiply) operator.
|
DBCompareColExpr |
notContains(Object value)
Creates and returns a new comparison object for the "not contains(column, val)" comparator
|
DBCompareColExpr |
notIn(Collection<?> values)
Creates and returns an expression for the SQL "not in" operator.
|
DBCompareColExpr |
notIn(DBExpr expr)
Creates and returns an expression for the SQL "not in" operator.
|
<T> DBCompareColExpr |
notIn(T... values)
Creates and returns an expression for the SQL "not in" operator.
|
DBCompareColExpr |
notLike(Object value)
Creates and returns a new comparison object for the SQL "not like" operator.
|
DBColumnExpr |
nvl(Object nullValue)
Deprecated.
Outdated oracle syntax - use coalesce instead
|
DBColumnJoinExpr |
on(DBColumnExpr joinWith)
create a join expression for DBCommand.join()
|
DBColumnExpr |
parenthesis()
Creates and returns a function object which
encloses the current expression in parenthesis.
|
DBCalcExpr |
plus(int value)
Creates and returns a new calculation object
for either the SQL "+" (plus) or "-" (minus) operator
depending on whether the supplied integer value is positive or negative.
|
DBCalcExpr |
plus(Object value)
Creates and returns a new calculation object
for the SQL "+" (plus) operator.
|
DBFuncExpr |
prepend(Object value)
Puts a value or expression before the current expression
|
DBAliasExpr |
qualified()
returns an expression that renames the column with its alias name
|
DBFuncExpr |
replace(Object match,
Object replace)
Creates and returns a sql-expression for the replace(...) function.
|
DBFuncExpr |
reverse()
Creates and returns a sql-expression for the reverse(...) function.
|
DBFuncExpr |
round(int decimals)
Creates and returns an function object that
rounds a number espression with the given decimals.
|
<T extends ColumnExpr> |
setAttribute(String name,
Object value)
Sets the value of a column attribute.
|
<T extends DBColumnExpr> |
setBeanPropertyName(String propertyName)
Sets the Java bean property name for this column.
|
<T extends DBColumnExpr> |
setControlType(String controlType)
Sets the controlType attribute.
|
<T extends DBColumnExpr> |
setDefaultSortOrder(Boolean descending)
Sets the default sort order
|
<T extends DBColumnExpr> |
setOptions(Options options)
Sets the options for this column indicating all valid values.
|
<T extends DBColumnExpr> |
setTitle(String title)
Sets the title attribute.
|
DBFuncExpr |
stringAgg(String separator)
Creates and returns string aggregation expression
|
DBFuncExpr |
stringAgg(String separator,
DBOrderByExpr orderBy)
Creates and returns string aggregation expression
|
DBFuncExpr |
substring(DBExpr pos)
Creates and returns a sql-expression for the substring(...) function.
|
DBFuncExpr |
substring(DBExpr pos,
DBExpr count)
Creates and returns a sql-expression for the substring(...) function.
|
DBFuncExpr |
substring(DBExpr pos,
int count)
Overloaded.
|
DBFuncExpr |
substring(int pos)
Overloaded.
|
DBFuncExpr |
substring(int pos,
DBExpr count)
Overloaded.
|
DBFuncExpr |
substring(int pos,
int count)
Overloaded.
|
DBFuncExpr |
sum()
Creates and returns an aggregation function object
which calculates the sum for the current expression over a group of rows.
|
DBConvertExpr |
toChar()
Creates a new DBFuncExpr object (to_char SQL statement)
with the parameters prefix = "to_char(" and postfix = ")"
|
DBConvertExpr |
toChar(String format)
Creates a new DBFuncExpr object (to_char SQL statement)
with the parameters prefix = "to_char(" and postfix = ", *
'"+format+"')"
|
String |
toString()
For Debugging
|
DBFuncExpr |
trim()
Creates and returns a sql-expression for the trim() function.
|
DBFuncExpr |
trimLeft()
Creates and returns a sql-expression for the ltrim() function.
|
DBFuncExpr |
trimRight()
Creates and returns a sql-expression for the rtrim() function.
|
DBFuncExpr |
trunc(int decimals)
Creates and returns an function object that
truncates a number espression with the given decimals.
|
DBFuncExpr |
upper()
Creates and returns a function object which
converts the current expression to upper case.
|
DBCaseExpr |
when(DBCompareExpr compExpr,
Object otherwise)
Creates and returns a sql-expression for the SQL case-phrase.
|
DBFuncExpr |
year()
Creates and returns an function object that
calculates the year of a date value.
|
addReferencedColumns, addSQLcheckParamNull, getDatabaseclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetEnumTypeprotected Attributes attributes
protected Options options
protected String beanPropertyName
public abstract DataType getDataType()
getDataType in interface ColumnExprDataTypepublic abstract String getName()
getName in interface ColumnExprpublic abstract DBRowSet getRowSet()
public abstract DBColumn getUpdateColumn()
getUpdateColumn in interface ColumnExpr@Deprecated public final DBColumn getSourceColumn()
getSourceColumn in interface ColumnExprpublic abstract boolean isAggregate()
public abstract Element addXml(Element parent, long flags)
parent - the parent element to which to append the column descriptionflags - currently not usedpublic DBAliasExpr qualified()
public Object getAttribute(String name)
getAttribute in interface ColumnExprname - the attribute namepublic <T> T getAttribute(String name, Class<T> type)
name - the attribute nametype - the desired Java typepublic <T extends ColumnExpr> T setAttribute(String name, Object value)
setAttribute in interface ColumnExprT - the column expression typename - the attribute namevalue - the value of the attributepublic Options getOptions()
getOptions in interface ColumnExprpublic <T extends DBColumnExpr> T setOptions(Options options)
T - the column expression typeoptions - the list of optionspublic final String getTitle()
getTitle in interface ColumnExprpublic <T extends DBColumnExpr> T setTitle(String title)
T - the column expression typetitle - the column titlepublic final String getControlType()
getControlType in interface ColumnExprpublic final <T extends DBColumnExpr> T setControlType(String controlType)
T - the column expression typecontrolType - the column control typepublic String getBeanPropertyName()
getBeanPropertyName in interface ColumnExprpublic <T extends DBColumnExpr> T setBeanPropertyName(String propertyName)
T - the column expression typepropertyName - the property namepublic boolean getDefaultSortOrder()
public <T extends DBColumnExpr> T setDefaultSortOrder(Boolean descending)
descending - true if the default sort order is ascending or false if descendingpublic boolean isCaseSensitive()
public DBColumnExpr getIgnoreCaseExpr()
public String getNumberType(ColumnExpr columnExpr)
columnExpr - the columnExprpublic DBAliasExpr as(String alias)
alias - the alias namepublic final DBAliasExpr as(DBColumn column)
column - the column whose name serves as an alias for the current expressionpublic DBCompareColExpr cmp(DBCmpType op, Object value)
op - the comparison operatorvalue - the Object valuepublic final DBCompareColExpr like(Object value)
value - the Object valuepublic DBCompareColExpr likeUpper(String value)
value - the Object value@Deprecated public DBCompareColExpr likeLower(String value)
value - the Object valuepublic DBCompareColExpr like(String value, char escape)
value - the Object valueescape - the escape characterpublic final DBCompareColExpr notLike(Object value)
value - the Object valuepublic final DBCompareColExpr contains(Object value)
value - the Object valuepublic final DBCompareColExpr notContains(Object value)
value - the Object valuepublic final DBCompareColExpr is(Object value)
value - the Object valuepublic final DBCompareColExpr isNot(Object value)
value - the Object valuepublic final DBCompareColExpr in(Collection<?> values)
values - the values to compare this column with@SafeVarargs public final <T> DBCompareColExpr in(T... values)
T - the value typevalues - the values to compare this column withpublic final DBCompareColExpr in(DBExpr expr)
expr - a database expression to provide a list of valuespublic final DBCompareColExpr notIn(Collection<?> values)
values - the values to compare this column with@SafeVarargs public final <T> DBCompareColExpr notIn(T... values)
T - the value typevalues - the values to compare this column withpublic final DBCompareColExpr notIn(DBExpr expr)
expr - a database expression to provide a list of valuespublic final DBCompareColExpr isBetween(Object minValue, Object maxValue)
minValue - the minimum valuemaxValue - the maximum valuepublic final DBCompareColExpr isNotBetween(Object minValue, Object maxValue)
minValue - the minimum valuemaxValue - the maximum valuepublic final DBCompareColExpr isGreaterThan(Object value)
value - the Object valuepublic final DBCompareColExpr isMoreOrEqual(Object value)
value - the Object valuepublic final DBCompareColExpr isLessOrEqual(Object value)
value - the Object valuepublic final DBCompareColExpr isSmallerThan(Object value)
value - the Object valuepublic DBCalcExpr multiplyWith(Object value)
value - the multiply valuepublic DBCalcExpr divideBy(Object value)
value - the divide valuepublic DBCalcExpr plus(Object value)
value - the summate valuepublic DBCalcExpr minus(Object value)
value - the subtract valuepublic DBCalcExpr plus(int value)
value - the subtract valuepublic DBCalcExpr minus(int value)
value - the subtract valuepublic DBConcatExpr append(Object value)
value - an Object valueprotected DBFuncExpr getExprFromPhrase(DBSqlPhrase phrase, Object[] params, DataType dataType)
phrase - the id of the SQL-phraseparams - the params to replace in the templatedataType - the resulting data Typeprotected final DBFuncExpr getExprFromPhrase(DBSqlPhrase phrase, Object[] params)
public DBColumnExpr parenthesis()
public DBCoalesceExpr coalesce(Object nullValue)
nullValue - the alternative value when this expression is nullpublic final DBFuncExpr modulo(Object divisor)
divisor - the Object value@Deprecated public DBColumnExpr nvl(Object nullValue)
nullValue - the int valuepublic final DBFuncExpr substring(DBExpr pos)
pos - the position number of the stringpublic DBFuncExpr substring(int pos)
pos - the position number of the stringpublic final DBFuncExpr substring(DBExpr pos, DBExpr count)
pos - the position number of the stringcount - the length of the substringpublic DBFuncExpr substring(DBExpr pos, int count)
pos - the position number of the stringcount - the length of the substringpublic DBFuncExpr substring(int pos, DBExpr count)
pos - the position number of the stringcount - the length of the substringpublic DBFuncExpr substring(int pos, int count)
pos - the position number of the stringcount - the length of the substringpublic final DBFuncExpr replace(Object match, Object replace)
match - string to replacereplace - string with replacementpublic final DBFuncExpr reverse()
public final DBFuncExpr trim()
public final DBFuncExpr trimLeft()
public final DBFuncExpr trimRight()
public final DBFuncExpr upper()
public final DBFuncExpr lower()
public final DBFuncExpr format(String format)
format - the format string. Beware: This is passed to the database "as is" and hence may be database specific.public final DBFuncExpr length()
public final DBFuncExpr indexOf(Object str)
str - the string to find the position ofpublic final DBFuncExpr indexOf(Object str, DBExpr fromPos)
str - the string to find the position offromPos - the start position for the searchpublic final DBFuncExpr indexOf(Object str, int fromPos)
str - the string to find the position offromPos - the start position for the searchpublic DBConcatFuncExpr concat(DBColumnExpr... concatExprs)
concatExprs - the expressions to concatpublic DBConcatFuncExpr concat(String separator, DBColumnExpr... concatExprs)
separator - a string to insert between each of the expressionsconcatExprs - the expressions to concatpublic DBFuncExpr prepend(Object value)
value - the expressions to prependpublic final DBFuncExpr abs()
public final DBFuncExpr floor()
public final DBFuncExpr ceiling()
public final DBFuncExpr round(int decimals)
decimals - the number of decimal to which to truncate the current valuepublic final DBFuncExpr trunc(int decimals)
decimals - the number of decimal to which to truncate the current valuepublic final DBFuncExpr year()
public final DBFuncExpr month()
public final DBFuncExpr day()
public final DBFuncExpr sum()
public final DBFuncExpr min()
public final DBFuncExpr max()
public final DBFuncExpr avg()
public final DBFuncExpr stringAgg(String separator, DBOrderByExpr orderBy)
separator - the separator between stringorderBy - the order by expressionpublic final DBFuncExpr stringAgg(String separator)
separator - the separator between stringpublic DBCountExpr count()
public DBCountExpr countDistinct()
public DBDecodeExpr decodeEnum(Class<? extends Enum<?>> enumType, String otherwise)
enumType - an enumType to decodeotherwise - the varchar value to take if no key matches the given expressionpublic DBDecodeExpr decodeSort(Class<? extends Enum<?>> enumType, boolean defaultToEnd)
enumType - an enumType to decodedefaultToEnd - true if non matching values (e.g. NULL) should be assigned the highest number, otherwise they get the lowest numberpublic DBDecodeExpr decode(Map<?,?> valueMap, Object otherwise)
valueMap - a list of key values pairs used for decodingotherwise - the value to take if no key matches the given expressionpublic final DBDecodeExpr decode(Object key1, Object value1, Object otherwise)
public final DBDecodeExpr decode(Object key1, Object value1, Object key2, Object value2, Object otherwise)
public final DBDecodeExpr decode(Object key1, Object value1, Object key2, Object value2, Object key3, Object value3, Object otherwise)
public final DBDecodeExpr decode(Options options, Object otherwise)
public final DBDecodeExpr decode(Options options)
public final DBCaseExpr when(DBCompareExpr compExpr, Object otherwise)
compExpr - the condition for which the current column expression is returnedotherwise - the value that is returned if the condition is falsepublic DBConvertExpr convertTo(DataType dataType, Object format)
dataType - the destination data typeformat - optional destination format (usually a string)public final DBConvertExpr convertTo(DataType dataType)
dataType - Data type to which to convert the current expression to.public final DBConvertExpr toChar()
public final DBConvertExpr toChar(String format)
format - the string valuepublic final DBColumnExpr function(String template, DataType returnType, Object... params)
template - the sql phrase template (see above)returnType - the returned DataTypeparams - the list of function parameter valuespublic final DBColumnExpr aggregate(String template, DataType returnType, Object... params)
template - the sql phrase template (see above)returnType - the returned DataTypeparams - additional function parameterspublic DBOrderByExpr asc()
public DBOrderByExpr desc()
public DBColumnJoinExpr on(DBColumnExpr joinWith)
joinWith - the column expression to join this expression withpublic Class<?> getJavaType()
protected boolean isLiteralValue(Object value)
value - the value to checkCopyright © 2008–2023 Apache Software Foundation. All rights reserved.