Class QueryAssembler
- java.lang.Object
-
- org.apache.cayenne.access.translator.select.QueryAssembler
-
- Direct Known Subclasses:
DefaultSelectTranslator
public abstract class QueryAssembler extends Object
Abstract superclass of Query translators.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interfaceQueryAssembler.AddBindingListener
-
Field Summary
Fields Modifier and Type Field Description protected DbAdapteradapterprotected QueryAssembler.AddBindingListeneraddBindingListenerprotected List<DbAttributeBinding>bindingsprotected EntityResolverentityResolverprotected Queryqueryprotected QueryMetadataqueryMetadataprotected Stringsqlprotected booleantranslated
-
Constructor Summary
Constructors Constructor Description QueryAssembler(Query query, DbAdapter adapter, EntityResolver entityResolver)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddToParamList(DbAttribute dbAttr, Object anObject)RegistersanObjectas a PreparedStatement parameter.abstract voiddbRelationshipAdded(DbRelationship relationship, JoinType joinType, String joinSplitAlias)Appends a join with given semantics to the query.protected abstract voiddoTranslate()protected voidensureTranslated()DbAdaptergetAdapter()abstract StringgetAliasForExpression(Expression exp)DbAttributeBinding[]getBindings()abstract StringgetCurrentAlias()Returns an alias of the table which is currently at the top of the join stack.EntityResolvergetEntityResolver()protected Map<String,String>getPathAliases()Returns aliases for the path splits defined in the query.QuerygetQuery()Returns query object being processed.QueryMetadatagetQueryMetadata()StringgetSql()Translates query into an SQL string formatted to use in a PreparedStatement.abstract voidresetJoinStack()A callback invoked by a child qualifier or ordering processor allowing query assembler to reset its join stack.voidsetAddBindingListener(QueryAssembler.AddBindingListener addBindingListener)booleansupportsTableAliases()Returnstrueif table aliases are supported.
-
-
-
Field Detail
-
query
protected Query query
-
queryMetadata
protected QueryMetadata queryMetadata
-
translated
protected boolean translated
-
sql
protected String sql
-
adapter
protected DbAdapter adapter
-
entityResolver
protected EntityResolver entityResolver
-
bindings
protected List<DbAttributeBinding> bindings
-
addBindingListener
protected QueryAssembler.AddBindingListener addBindingListener
- Since:
- 4.0
-
-
Constructor Detail
-
QueryAssembler
public QueryAssembler(Query query, DbAdapter adapter, EntityResolver entityResolver)
- Since:
- 4.0
-
-
Method Detail
-
getPathAliases
protected Map<String,String> getPathAliases()
Returns aliases for the path splits defined in the query.- Since:
- 3.0
-
getEntityResolver
public EntityResolver getEntityResolver()
-
getAdapter
public DbAdapter getAdapter()
-
getQuery
public Query getQuery()
Returns query object being processed.
-
getQueryMetadata
public QueryMetadata getQueryMetadata()
-
resetJoinStack
public abstract void resetJoinStack()
A callback invoked by a child qualifier or ordering processor allowing query assembler to reset its join stack.- Since:
- 3.0
-
getCurrentAlias
public abstract String getCurrentAlias()
Returns an alias of the table which is currently at the top of the join stack.- Since:
- 3.0
-
dbRelationshipAdded
public abstract void dbRelationshipAdded(DbRelationship relationship, JoinType joinType, String joinSplitAlias)
Appends a join with given semantics to the query.- Since:
- 3.0
-
getSql
public String getSql()
Translates query into an SQL string formatted to use in a PreparedStatement.
-
ensureTranslated
protected void ensureTranslated()
- Since:
- 4.0
-
doTranslate
protected abstract void doTranslate()
- Since:
- 4.0
-
supportsTableAliases
public boolean supportsTableAliases()
Returnstrueif table aliases are supported. Default implementation returns false.
-
addToParamList
public void addToParamList(DbAttribute dbAttr, Object anObject)
RegistersanObjectas a PreparedStatement parameter.- Parameters:
anObject- object that represents a value of DbAttributedbAttr- DbAttribute being processed.
-
getBindings
public DbAttributeBinding[] getBindings()
- Since:
- 4.0
-
getAliasForExpression
public abstract String getAliasForExpression(Expression exp)
- Since:
- 4.0
-
setAddBindingListener
public void setAddBindingListener(QueryAssembler.AddBindingListener addBindingListener)
- Since:
- 4.0
-
-