org.modeshape.graph.query
Class QueryBuilder.JoinClause

java.lang.Object
  extended by org.modeshape.graph.query.QueryBuilder.JoinClause
Enclosing class:
QueryBuilder

public class QueryBuilder.JoinClause
extends Object

Class used to specify a join clause of a query.

See Also:
QueryBuilder.join(String), QueryBuilder.innerJoin(String), QueryBuilder.leftOuterJoin(String), QueryBuilder.rightOuterJoin(String), QueryBuilder.fullOuterJoin(String)

Constructor Summary
protected QueryBuilder.JoinClause(NamedSelector rightTable, JoinType type)
           
 
Method Summary
protected  QueryBuilder createJoin(JoinCondition condition)
           
protected  SelectorName nameOf(String tableName)
          Walk the current source or the 'rightSource' to find the named selector with the supplied name or alias
 QueryBuilder on(String columnEqualExpression)
          Define the join as using an equi-join criteria by specifying the expression equating two columns.
 QueryBuilder onChildNode(String parentTable, String childTable)
          Define the join criteria to require the node in one table is a child of the node in another table.
 QueryBuilder onDescendant(String ancestorTable, String descendantTable)
          Define the join criteria to require the node in one table is a descendant of the node in another table.
 QueryBuilder onSameNode(String table1, String table2)
          Define the join criteria to require the two tables represent the same node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryBuilder.JoinClause

protected QueryBuilder.JoinClause(NamedSelector rightTable,
                                  JoinType type)
Method Detail

nameOf

protected SelectorName nameOf(String tableName)
Walk the current source or the 'rightSource' to find the named selector with the supplied name or alias

Parameters:
tableName - the table name
Returns:
the selector name matching the supplied table name; never null
Throws:
IllegalArgumentException - if the table name could not be resolved

on

public QueryBuilder on(String columnEqualExpression)
Define the join as using an equi-join criteria by specifying the expression equating two columns. Each column reference must be qualified with the appropriate table name or alias.

Parameters:
columnEqualExpression - the equality expression between the two tables; may not be null
Returns:
the query builder instance, for method chaining purposes
Throws:
IllegalArgumentException - if the supplied expression is not an equality expression

onSameNode

public QueryBuilder onSameNode(String table1,
                               String table2)
Define the join criteria to require the two tables represent the same node. The supplied tables must be a valid name or alias.

Parameters:
table1 - the name or alias of the first table
table2 - the name or alias of the second table
Returns:
the query builder instance, for method chaining purposes

onDescendant

public QueryBuilder onDescendant(String ancestorTable,
                                 String descendantTable)
Define the join criteria to require the node in one table is a descendant of the node in another table. The supplied tables must be a valid name or alias.

Parameters:
ancestorTable - the name or alias of the table containing the ancestor node
descendantTable - the name or alias of the table containing the descendant node
Returns:
the query builder instance, for method chaining purposes

onChildNode

public QueryBuilder onChildNode(String parentTable,
                                String childTable)
Define the join criteria to require the node in one table is a child of the node in another table. The supplied tables must be a valid name or alias.

Parameters:
parentTable - the name or alias of the table containing the parent node
childTable - the name or alias of the table containing the child node
Returns:
the query builder instance, for method chaining purposes

createJoin

protected QueryBuilder createJoin(JoinCondition condition)


Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.