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_NOPARENTHESES, 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 |
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 |
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) |
DBOrderByExpr |
desc()
creates a new DBOrderByExpr for descending order
|
protected DataType |
detectDataType(Object value)
Detects the DataType of a given value.
|
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()
|
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(int phrase,
Object[] params,
DBColumn updateColumn,
boolean isAggregate) |
protected DBColumnExpr |
getExprFromPhrase(int phrase,
Object[] params,
DBColumn updateColumn,
boolean isAggregate,
DataType dataType)
Creates a new DBFuncExpr from a given SQL-PRHASE and
optional additional parameters.
|
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.
|
Column |
getSourceColumn()
Returns the source column.
|
String |
getTitle()
Returns the title attribute.
|
abstract DBColumn |
getUpdateColumn()
Returns the underlying physical column which may be used for updates.
|
DBCompareColExpr |
in(Object value)
Creates and returns a new comparison object
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 wheter 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(Object value)
Creates and returns a new comparison object
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
|
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 |
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.
|
void |
setAttribute(String name,
Object value)
Sets the value of a column attribute.
|
void |
setBeanPropertyName(String propertyName)
Sets the Java bean property name for this column.
|
void |
setControlType(String controlType)
Sets the controlType attribute.
|
void |
setOptions(Options options)
Sets the options for this column indicating all valid values.
|
void |
setTitle(String title)
Sets the title attribute.
|
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+"')"
|
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, getObjectValue, getValueClass
getDatabase
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 getUpdateColumn()
public abstract Element addXml(Element parent, long flags)
parent
- the parent element to which to append the column descriptionflags
- currently not usedpublic Object getAttribute(String name)
getAttribute
in interface ColumnExpr
name
- the attribute namepublic void setAttribute(String name, Object value)
name
- the attribute namevalue
- the value of the attributepublic Options getOptions()
getOptions
in interface ColumnExpr
public void setOptions(Options options)
options
- the list of optionspublic final String getTitle()
getTitle
in interface ColumnExpr
public final void setTitle(String title)
title
- the column titlepublic final String getControlType()
getControlType
in interface ColumnExpr
public final void setControlType(String controlType)
controlType
- the column control typepublic final Column getSourceColumn()
getSourceColumn
in interface ColumnExpr
public String getBeanPropertyName()
getBeanPropertyName
in interface ColumnExpr
public void setBeanPropertyName(String propertyName)
propertyName
- public DBColumnExpr append(Object value)
value
- an Object valuepublic DBColumnExpr as(String alias)
alias
- the alias namepublic 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 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 DBCompareColExpr notLike(Object value)
value
- the Object valuepublic DBCompareColExpr is(Object value)
value
- the Object valuepublic DBCompareColExpr isNot(Object value)
value
- the Object valuepublic DBCompareColExpr in(Object value)
value
- the int valuepublic DBCompareColExpr notIn(Object value)
value
- the int valuepublic DBCompareColExpr isBetween(Object minValue, Object maxValue)
minValue
- the minimum valuemaxValue
- the maximum valuepublic DBCompareColExpr isNotBetween(Object minValue, Object maxValue)
minValue
- the minimum valuemaxValue
- the maximum valuepublic DBCompareColExpr isGreaterThan(Object value)
value
- the Object valuepublic DBCompareColExpr isMoreOrEqual(Object value)
value
- the Object valuepublic DBCompareColExpr isLessOrEqual(Object value)
value
- the Object valuepublic 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(int phrase, Object[] params, DBColumn updateColumn, boolean isAggregate, DataType dataType)
phrase
- the id of the SQL-phraseparams
- the params to replace in the templateisAggregate
- indicates whether the Function creates an aggregatedataType
- the resulting data Typeprotected DBColumnExpr getExprFromPhrase(int phrase, Object[] params, DBColumn updateColumn, boolean isAggregate)
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 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 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 count()
public DBColumnExpr countDistinct()
protected DataType detectDataType(Object value)
value
- the value to detectpublic 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 DBOrderByExpr asc()
public DBOrderByExpr desc()
Copyright © 2008–2017 Apache Software Foundation. All rights reserved.