|
|||||||||
| Home >> All >> org >> objectstyle >> cayenne >> [ map overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.objectstyle.cayenne.map
Class DerivedDbAttribute

java.lang.Objectorg.objectstyle.cayenne.map.MapObject
org.objectstyle.cayenne.map.Attribute
org.objectstyle.cayenne.map.DbAttribute
org.objectstyle.cayenne.map.DerivedDbAttribute
- All Implemented Interfaces:
- org.objectstyle.cayenne.util.CayenneMapEntry
- public class DerivedDbAttribute
- extends DbAttribute
A DerivedDbAttribute is a DbAttribute that resolves to an SQL expression based on
a set of other attributes. DerivedDbAttribute's allow to build
expressions like "count(id)", "sum(price)", etc.
Internally DerivedDbAttribute is defined as a specification string and a set of
substitution DbAttribute parameters. Specification string is an SQL expression that contains
placeholders (%@) for attribute parameters, for example:
sum(%@) + sum(%@)
| Field Summary | |
static java.lang.String |
ATTRIBUTE_TOKEN
|
protected java.lang.String |
expressionSpec
|
protected boolean |
groupBy
|
protected java.util.List |
params
|
| Fields inherited from class org.objectstyle.cayenne.map.DbAttribute |
mandatory, maxLength, precision, primaryKey, type |
| Fields inherited from class org.objectstyle.cayenne.map.MapObject |
objName, objParent |
| Constructor Summary | |
DerivedDbAttribute()
Constructor for DerivedDbAttribute. |
|
DerivedDbAttribute(DbEntity entity,
DbAttribute parentProto)
Creates and initializes a derived attribute with an attribute of a parent entity. |
|
DerivedDbAttribute(java.lang.String name)
Constructor for DerivedDbAttribute. |
|
DerivedDbAttribute(java.lang.String name,
int type,
DbEntity entity,
java.lang.String spec)
Constructor for DerivedDbAttribute. |
|
| Method Summary | |
void |
addParam(DbAttribute param)
Sets the params. |
void |
clearParams()
|
java.lang.String |
getAliasedName(java.lang.String alias)
|
java.lang.String |
getExpressionSpec()
Returns the expressionSpec. |
java.util.List |
getParams()
Returns the params. |
boolean |
isGroupBy()
Returns true if this attribute is used in GROUP BY clause of the parent entity. |
void |
removeParam(DbAttribute param)
|
void |
setExpressionSpec(java.lang.String expressionSpec)
Sets the expressionSpec. |
void |
setGroupBy(boolean flag)
|
| Methods inherited from class org.objectstyle.cayenne.map.DbAttribute |
getMaxLength, getPrecision, getType, isMandatory, isPrimaryKey, setMandatory, setMaxLength, setPrecision, setPrimaryKey, setType, toString, toStringBuffer |
| Methods inherited from class org.objectstyle.cayenne.map.Attribute |
getEntity, setEntity |
| Methods inherited from class org.objectstyle.cayenne.map.MapObject |
getName, getParent, setName, setParent |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
ATTRIBUTE_TOKEN
public static final java.lang.String ATTRIBUTE_TOKEN
- See Also:
- Constant Field Values
expressionSpec
protected java.lang.String expressionSpec
params
protected java.util.List params
groupBy
protected boolean groupBy
| Constructor Detail |
DerivedDbAttribute
public DerivedDbAttribute()
- Constructor for DerivedDbAttribute.
DerivedDbAttribute
public DerivedDbAttribute(java.lang.String name)
- Constructor for DerivedDbAttribute.
DerivedDbAttribute
public DerivedDbAttribute(java.lang.String name, int type, DbEntity entity, java.lang.String spec)
- Constructor for DerivedDbAttribute.
DerivedDbAttribute
public DerivedDbAttribute(DbEntity entity, DbAttribute parentProto)
- Creates and initializes a derived attribute with
an attribute of a parent entity.
| Method Detail |
getAliasedName
public java.lang.String getAliasedName(java.lang.String alias)
- Overrides:
getAliasedNamein classDbAttribute
isGroupBy
public boolean isGroupBy()
- Returns true if this attribute is used in GROUP BY
clause of the parent entity.
setGroupBy
public void setGroupBy(boolean flag)
getParams
public java.util.List getParams()
- Returns the params.
getExpressionSpec
public java.lang.String getExpressionSpec()
- Returns the expressionSpec.
addParam
public void addParam(DbAttribute param)
- Sets the params.
removeParam
public void removeParam(DbAttribute param)
clearParams
public void clearParams()
setExpressionSpec
public void setExpressionSpec(java.lang.String expressionSpec)
- Sets the expressionSpec.
|
|||||||||
| Home >> All >> org >> objectstyle >> cayenne >> [ map overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC