dk.eobjects.metamodel.query
Class FromItem

Package class diagram package FromItem
java.lang.Object
  extended by dk.eobjects.metamodel.query.FromItem
All Implemented Interfaces:
IQueryItem, java.io.Serializable, java.lang.Cloneable

public class FromItem
extends java.lang.Object
implements IQueryItem, java.lang.Cloneable

Represents a FROM item. FROM items can take different forms:

See Also:
FromClause, Serialized Form

Constructor Summary
FromItem(JoinType join, FromItem leftSide, FromItem rightSide, SelectItem[] leftOn, SelectItem[] rightOn)
          Constructor for advanced join types with custom relationships
FromItem(JoinType join, Relationship relationship)
          Constructor for join FROM clauses that join two tables using their relationship.
FromItem(Query subQuery)
          Constructor for sub-query FROM clauses
FromItem(java.lang.String expression)
          Creates a single unvalidated from item based on a expression.
FromItem(Table table)
          Constructor for table FROM clauses
 
Method Summary
protected  FromItem clone()
           
 boolean equals(java.lang.Object obj)
           
 java.lang.String getAlias()
           
 java.lang.String getAlias(Table table)
          Gets the alias of a table, if it is registered (and visible, ie.
 java.lang.String getExpression()
           
 JoinType getJoin()
           
 SelectItem[] getLeftOn()
           
 FromItem getLeftSide()
           
 Query getQuery()
           
 SelectItem[] getRightOn()
           
 FromItem getRightSide()
           
 java.lang.String getSameQueryAlias()
           
 Query getSubQuery()
           
 Table getTable()
           
 FromItem setAlias(java.lang.String alias)
           
 IQueryItem setQuery(Query query)
           
 java.lang.String toString()
           
 java.lang.String toStringNoAlias()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FromItem

public FromItem(Table table)
Constructor for table FROM clauses


FromItem

public FromItem(Query subQuery)
Constructor for sub-query FROM clauses

Parameters:
subQuery - the subquery to use

FromItem

public FromItem(JoinType join,
                Relationship relationship)
Constructor for join FROM clauses that join two tables using their relationship. The primary table of the relationship will be the left side of the join and the foreign table of the relationship will be the right side of the join.

Parameters:
join - the join type to use
relationship - the relationship to use for joining the tables

FromItem

public FromItem(JoinType join,
                FromItem leftSide,
                FromItem rightSide,
                SelectItem[] leftOn,
                SelectItem[] rightOn)
Constructor for advanced join types with custom relationships

Parameters:
join - the join type to use
leftSide - the left side of the join
rightSide - the right side of the join
leftOn - what left-side select items to use for the ON clause
rightOn - what right-side select items to use for the ON clause

FromItem

public FromItem(java.lang.String expression)
Creates a single unvalidated from item based on a expression. Expression based from items are typically NOT datastore-neutral but are available for special "hacking" needs. Expression based from items can only be used for JDBC based datastores since they are translated directly into SQL.

Parameters:
expression - An expression to use for the from item, for example "MYTABLE".
Method Detail

getAlias

public java.lang.String getAlias()

getSameQueryAlias

public java.lang.String getSameQueryAlias()

setAlias

public FromItem setAlias(java.lang.String alias)

getTable

public Table getTable()

getSubQuery

public Query getSubQuery()

getJoin

public JoinType getJoin()

getLeftSide

public FromItem getLeftSide()

getRightSide

public FromItem getRightSide()

getLeftOn

public SelectItem[] getLeftOn()

getRightOn

public SelectItem[] getRightOn()

getExpression

public java.lang.String getExpression()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toStringNoAlias

public java.lang.String toStringNoAlias()

getAlias

public java.lang.String getAlias(Table table)
Gets the alias of a table, if it is registered (and visible, ie. not part of a sub-query) in the FromItem

Parameters:
table - the table to get the alias for
Returns:
the alias or null if none is found

getQuery

public Query getQuery()
Specified by:
getQuery in interface IQueryItem

setQuery

public IQueryItem setQuery(Query query)
Specified by:
setQuery in interface IQueryItem

clone

protected FromItem clone()
Overrides:
clone in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object


Copyright © 2007-2010. All Rights Reserved.