public abstract class DBColumnExpr extends DBExpr implements ColumnExpr
Modifier and Type | Field and Description |
---|---|
protected Attributes |
attributes |
protected String |
beanPropertyName |
static String |
DBCOLATTR_TITLE |
static String |
DBCOLATTR_TYPE |
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 |
---|---|
DBColumnExpr |
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:
?
|
DBColumnExpr |
append(Object value)
Creates a new DBConcatExpr object with the specified value.
|
DBColumnExpr |
as(DBColumn column)
creates a new DBAliasExpr which renames the current expression to the name of the supplied column.
|
DBColumnExpr |
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
|
DBColumnExpr |
avg()
Creates and returns an aggregation function object
which returns the average value for the current expression over a group of rows.
|
DBColumnExpr |
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.
|
DBColumnExpr |
coalesce(Object nullValue)
Creates a sql-expression for the nvl() or coalesce() function.
|
DBColumnExpr |
concat(DBColumnExpr... concatExprs)
concatenates a list of expressions to the current column
|
DBColumnExpr |
concat(String separator,
DBColumnExpr... concatExprs)
concatenates a list of expressions to the current column
|
DBColumnExpr |
convertTo(DataType dataType)
Creates and returns a new DBFuncExpr object that will
convert the current column to the destination data type specified.
|
DBColumnExpr |
convertTo(DataType dataType,
Object format)
Creates a new DBFuncExpr object that will convert
the current column to the destination data type specified.
|
DBColumnExpr |
count()
Creates and returns an expression for the SQL "count()" function
which returns the number of rows in the result set.
|
DBColumnExpr |
countDistinct()
Creates and returns an expression for the SQL "count()" function
which returns the number of unique values in the result set.
|
DBColumnExpr |
day()
Creates and returns an function object that
calculates the day of a date value.
|
DBColumnExpr |
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.
|
DBColumnExpr |
decode(Object key1,
Object value1,
Object otherwise) |
DBColumnExpr |
decode(Object key1,
Object value1,
Object key2,
Object value2,
Object otherwise) |
DBColumnExpr |
decode(Object key1,
Object value1,
Object key2,
Object value2,
Object key3,
Object value3,
Object otherwise) |
DBColumnExpr |
decode(Options options) |
DBColumnExpr |
decode(Options options,
Object otherwise) |
DBColumnExpr |
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
|
DBColumnExpr |
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.
|
DBColumnExpr |
floor()
Create and returns an expression for the SQL-function floor()
|
DBColumnExpr |
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.
|
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.
|
protected DBColumnExpr |
getExprFromPhrase(DBSqlPhrase phrase,
Object[] params) |
protected DBColumnExpr |
getExprFromPhrase(DBSqlPhrase phrase,
Object[] params,
DataType dataType)
Creates a new DBFuncExpr from a given SQL-PRHASE and
optional additional parameters.
|
Class<?> |
getJavaType()
returns a corresponding Java type for this expression
|
abstract String |
getName()
Returns the column name for this column expression.
|
Options |
getOptions()
Returns the list of options for this column
containing all possible field values.
|
abstract DBColumn |
getSourceColumn()
Returns the underlying physical column which was used for this expression
For functions involving none or more than one physical column this function return the first one
|
String |
getTitle()
Returns the title attribute.
|
abstract DBColumn |
getUpdateColumn()
Returns the underlying physical column which may be used for updates.
|
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.
|
DBColumnExpr |
indexOf(Object str)
Creates and returns a sql-expression that returns the position of a string in the current column expression.
|
DBColumnExpr |
indexOf(Object str,
DBExpr fromPos)
Creates and returns a sql-expression that returns the position of a string in the current column expression.
|
DBColumnExpr |
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.
|
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.
|
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.
|
DBColumnExpr |
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)
Creates and returns a new comparison object for the SQL "like" operator.
|
DBCompareColExpr |
likeUpper(String value)
Creates and returns a new comparison object for the SQL "like" operator.
|
DBColumnExpr |
lower()
Creates and returns a function object which
converts the current expression to lower case.
|
DBColumnExpr |
max()
Creates and returns an aggregation function object
which returns the maximum value for the current expression over a group of rows.
|
DBColumnExpr |
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.
|
DBColumnExpr |
modulo(Object divisor)
Creates a sql-expression for the modulo or mod() function.
|
DBColumnExpr |
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 |
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.
|
DBColumnExpr |
qualified()
returns an expression that renames the column with its alias name
|
DBColumnExpr |
replace(Object match,
Object replace)
Creates and returns a sql-expression for the replace(...) function.
|
DBColumnExpr |
reverse()
Creates and returns a sql-expression for the reverse(...) function.
|
DBColumnExpr |
round(int decimals)
Creates and returns an function object that
rounds a number espression with the given decimals.
|
<T extends DBColumnExpr> |
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> |
setOptions(Options options)
Sets the options for this column indicating all valid values.
|
<T extends DBColumnExpr> |
setTitle(String title)
Sets the title attribute.
|
DBColumnExpr |
stringAgg(String separator)
Creates and returns string aggregation expression
|
DBColumnExpr |
stringAgg(String separator,
DBOrderByExpr orderBy)
Creates and returns string aggregation expression
|
DBColumnExpr |
substring(DBExpr pos)
Creates and returns a sql-expression for the substring(...) function.
|
DBColumnExpr |
substring(DBExpr pos,
DBExpr count)
Creates and returns a sql-expression for the substring(...) function.
|
DBColumnExpr |
substring(DBExpr pos,
int count)
Overloaded.
|
DBColumnExpr |
substring(int pos)
Overloaded.
|
DBColumnExpr |
substring(int pos,
DBExpr count)
Overloaded.
|
DBColumnExpr |
substring(int pos,
int count)
Overloaded.
|
DBColumnExpr |
sum()
Creates and returns an aggregation function object
which calculates the sum for the current expression over a group of rows.
|
DBColumnExpr |
toChar()
Creates a new DBFuncExpr object (to_char SQL statement)
with the parameters prefix = "to_char(" and postfix = ")"
|
DBColumnExpr |
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
|
DBColumnExpr |
trim()
Creates and returns a sql-expression for the trim() function.
|
DBColumnExpr |
trimLeft()
Creates and returns a sql-expression for the ltrim() function.
|
DBColumnExpr |
trimRight()
Creates and returns a sql-expression for the rtrim() function.
|
DBColumnExpr |
trunc(int decimals)
Creates and returns an function object that
truncates a number espression with the given decimals.
|
DBColumnExpr |
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.
|
DBColumnExpr |
year()
Creates and returns an function object that
calculates the year of a date value.
|
addReferencedColumns, addSQL
checkParamNull, getDatabase
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getEnumType
public static final String DBCOLATTR_TITLE
public static final String DBCOLATTR_TYPE
protected Attributes attributes
protected Options options
protected String beanPropertyName
public abstract DataType getDataType()
getDataType
in interface ColumnExpr
DataType
public abstract String getName()
getName
in interface ColumnExpr
public abstract boolean isAggregate()
public abstract DBColumn getSourceColumn()
getSourceColumn
in interface ColumnExpr
public abstract DBColumn getUpdateColumn()
public abstract Element addXml(Element parent, long flags)
parent
- the parent element to which to append the column descriptionflags
- currently not usedpublic DBColumnExpr qualified()
public Object getAttribute(String name)
getAttribute
in interface ColumnExpr
name
- the attribute namepublic <T extends DBColumnExpr> T setAttribute(String name, Object value)
name
- the attribute namevalue
- the value of the attributepublic Options getOptions()
getOptions
in interface ColumnExpr
public <T extends DBColumnExpr> T setOptions(Options options)
options
- the list of optionspublic final String getTitle()
getTitle
in interface ColumnExpr
public <T extends DBColumnExpr> T setTitle(String title)
title
- the column titlepublic final String getControlType()
getControlType
in interface ColumnExpr
public final <T extends DBColumnExpr> T setControlType(String controlType)
controlType
- the column control typepublic String getBeanPropertyName()
getBeanPropertyName
in interface ColumnExpr
public <T extends DBColumnExpr> T setBeanPropertyName(String propertyName)
propertyName
- public DBColumnExpr append(Object value)
value
- an Object valuepublic DBColumnExpr as(String alias)
alias
- the alias namepublic final DBColumnExpr 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 valuepublic 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 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)
values
- 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)
values
- 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 valueprotected DBColumnExpr 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 DBColumnExpr getExprFromPhrase(DBSqlPhrase phrase, Object[] params)
public DBColumnExpr parenthesis()
public DBColumnExpr coalesce(Object nullValue)
nullValue
- the Object valuepublic DBColumnExpr modulo(Object divisor)
divisor
- the Object value@Deprecated public DBColumnExpr nvl(Object nullValue)
nullValue
- the int valuepublic DBColumnExpr substring(DBExpr pos)
pos
- the position number of the stringpublic DBColumnExpr substring(int pos)
pos
- the position number of the stringpublic DBColumnExpr substring(DBExpr pos, DBExpr count)
pos
- the position number of the stringcount
- the length of the substringpublic DBColumnExpr substring(DBExpr pos, int count)
pos
- the position number of the stringcount
- the length of the substringpublic DBColumnExpr substring(int pos, DBExpr count)
pos
- the position number of the stringcount
- the length of the substringpublic DBColumnExpr substring(int pos, int count)
pos
- the position number of the stringcount
- the length of the substringpublic DBColumnExpr replace(Object match, Object replace)
match
- string to replacereplace
- string with replacementpublic DBColumnExpr reverse()
public DBColumnExpr trim()
public DBColumnExpr trimLeft()
public DBColumnExpr trimRight()
public DBColumnExpr upper()
public DBColumnExpr lower()
public DBColumnExpr format(String format)
format
- the format string. Beware: This is passed to the database "as is" and hence may be database specific.public DBColumnExpr length()
public DBColumnExpr indexOf(Object str)
str
- the string to find the position ofpublic DBColumnExpr indexOf(Object str, DBExpr fromPos)
str
- the string to find the position offromPos
- the start position for the searchpublic DBColumnExpr indexOf(Object str, int fromPos)
str
- the string to find the position offromPos
- the start position for the searchpublic DBColumnExpr concat(DBColumnExpr... concatExprs)
concatExprs
- the expressions to concatpublic DBColumnExpr concat(String separator, DBColumnExpr... concatExprs)
separator
- a string to insert between each of the expressionsconcatExprs
- the expressions to concatpublic DBColumnExpr abs()
public DBColumnExpr floor()
public DBColumnExpr ceiling()
public DBColumnExpr round(int decimals)
decimals
- the number of decimal to which to truncate the current valuepublic DBColumnExpr trunc(int decimals)
decimals
- the number of decimal to which to truncate the current valuepublic DBColumnExpr year()
public DBColumnExpr month()
public DBColumnExpr day()
public DBColumnExpr sum()
public DBColumnExpr min()
public DBColumnExpr max()
public DBColumnExpr avg()
public DBColumnExpr stringAgg(String separator, DBOrderByExpr orderBy)
separator
- the separator between stringpublic DBColumnExpr stringAgg(String separator)
separator
- the separator between stringpublic DBColumnExpr count()
public DBColumnExpr countDistinct()
public DBColumnExpr decodeEnum(Class<? extends Enum<?>> enumType, String otherwise)
enumType
- an enumType to decodeotherwise
- the varchar value to take if no key matches the given expressionpublic DBColumnExpr 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 DBColumnExpr 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 DBColumnExpr decode(Object key1, Object value1, Object otherwise)
public final DBColumnExpr decode(Object key1, Object value1, Object key2, Object value2, Object otherwise)
public final DBColumnExpr decode(Object key1, Object value1, Object key2, Object value2, Object key3, Object value3, Object otherwise)
public final DBColumnExpr decode(Options options, Object otherwise)
public final DBColumnExpr 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 DBColumnExpr toChar()
public DBColumnExpr toChar(String format)
format
- the string valuepublic DBColumnExpr convertTo(DataType dataType, Object format)
dataType
- the destination data typeformat
- optional destination format (usually a string)public final DBColumnExpr convertTo(DataType dataType)
dataType
- Data type to which to convert the current expression to.public 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()
Copyright © 2008–2023 Apache Software Foundation. All rights reserved.