Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

oracle.javatools.db.sql
Class AbstractAliasFragment

java.lang.Object
  extended by oracle.javatools.db.AbstractDBObject
      extended by oracle.javatools.db.AbstractChildDBObject
          extended by oracle.javatools.db.sql.AbstractSQLFragment
              extended by oracle.javatools.db.sql.AbstractAliasFragment
All Implemented Interfaces:
ChildDBObject, DBObject, AliasFragment, SQLFragment, Copyable, DynamicPropertySet
Direct Known Subclasses:
FromObject, SelectObject

public abstract class AbstractAliasFragment
extends AbstractSQLFragment
implements AliasFragment

SQLFragment that consists of an expression and an alias.

Since:
10.1.3

Nested Class Summary
 
Nested classes/interfaces inherited from class oracle.javatools.db.AbstractDBObject
AbstractDBObject.ChildSupport
 
Field Summary
 
Fields inherited from class oracle.javatools.db.sql.AbstractSQLFragment
DEFAULT_SEPARATOR, EMPTY, EMPTY_ARRAY, NEWLINE, SPACE
 
Fields inherited from interface oracle.javatools.db.sql.SQLFragment
CONNECTBY, FROM, GROUPBY, HAVING, NOCYCLE, ORDERBY, SELECT, STARTWITH, TYPE, WHERE
 
Fields inherited from interface oracle.javatools.db.DBObject
COMMENT
 
Constructor Summary
protected AbstractAliasFragment()
          Creates an empty fragment.
protected AbstractAliasFragment(SQLFragment exp, java.lang.String alias)
          Creates a fragment with given expression and alias.
 
Method Summary
 boolean canHaveAlias()
          In certain circumstances an AliasFragment cannot have an alias.
protected  boolean canUseAsAlias(java.lang.String exp)
          Checks whether the given expression can be used as an alias.
protected  void copyToImpl(AbstractAliasFragment copy, DBObject copyParent, IDPolicy idPolicy)
           
protected  boolean equalsImpl(AbstractAliasFragment other)
           
 java.lang.String getAlias()
          Returns the alias portion of this SQLFragment.
 SQLFragment getExpression()
          Returns the expression portion of this SQLFragment.
 java.lang.String getName()
          Returns a String that can be used to alias columns that depend on this fragment.
protected  void getOwnedObjectsImpl(java.util.Collection<DBObject> objs, java.lang.String... types)
          Used by all the final children methods.
 java.lang.String getSQLText()
          Returns the entire fragment (expression plus alias in external form).
 java.lang.String getUsableAlias()
          Deprecated. - use getName()
 void setAlias(java.lang.String alias)
          Sets the alias part of the fragment.
 void setExpression(SQLFragment exp)
          Sets the expression part of the fragment.
 void setName(java.lang.String name)
          Does nothing for this fragment - an alias fragment's name is derived from it's alias or expression.
 java.lang.String toString()
           
protected  boolean useAsBeforeAlias()
          Returns true if the current fragment should have an AS between expression and alias.
 
Methods inherited from class oracle.javatools.db.sql.AbstractSQLFragment
appendToBuffer, argsToString, getTextOrNull, getTextOrNull, getType, setParent, surroundWithBrackets, surroundWithBrackets
 
Methods inherited from class oracle.javatools.db.AbstractChildDBObject
copyToImpl, findParent, getParent
 
Methods inherited from class oracle.javatools.db.AbstractDBObject
changeParent, compareToImpl, copyObject, copyTo, copyTo, copyTo, copyTo, copyToImpl, equalsImpl, findOwnedObject, findOwnedObject, findOwnedObject, getChildSupport, getID, getOwnedObjects, getOwnedObjects, getProperties, getProperty, getProperty, getReferenceIDs, getReferenceIDsImpl, hashCode, includeOwnedObject, includesType, includesType, removeThisAsParent, replaceReferenceIDs, setID, setProperties, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface oracle.javatools.db.ChildDBObject
getParent, setParent
 
Methods inherited from interface oracle.javatools.db.DBObject
copyTo, copyTo, copyTo, findOwnedObject, findOwnedObject, getID, getOwnedObjects, getOwnedObjects, getReferenceIDs, getType, replaceReferenceIDs, setID
 
Methods inherited from interface oracle.javatools.util.DynamicPropertySet
getProperties, getProperty, getProperty, setProperties, setProperty
 

Constructor Detail

AbstractAliasFragment

protected AbstractAliasFragment()
Creates an empty fragment.


AbstractAliasFragment

protected AbstractAliasFragment(SQLFragment exp,
                                java.lang.String alias)
Creates a fragment with given expression and alias. The alias name should be in its external form, i.e. be quoted if necessary

Method Detail

getAlias

public java.lang.String getAlias()
Returns the alias portion of this SQLFragment.

Specified by:
getAlias in interface AliasFragment

setAlias

public void setAlias(java.lang.String alias)
Sets the alias part of the fragment. The alias name should be in its external form, i.e. be quoted if necessary

Specified by:
setAlias in interface AliasFragment

canHaveAlias

public boolean canHaveAlias()
In certain circumstances an AliasFragment cannot have an alias. This method returns false if that is the case.


getExpression

public SQLFragment getExpression()
Returns the expression portion of this SQLFragment.

Specified by:
getExpression in interface AliasFragment

setExpression

public void setExpression(SQLFragment exp)
Sets the expression part of the fragment.

Specified by:
setExpression in interface AliasFragment

getSQLText

public java.lang.String getSQLText()
Returns the entire fragment (expression plus alias in external form).

Specified by:
getSQLText in interface AliasFragment
Specified by:
getSQLText in interface SQLFragment
Returns:
a string representing the SQL text for this object.

useAsBeforeAlias

protected boolean useAsBeforeAlias()
Returns true if the current fragment should have an AS between expression and alias. Returns false by default, subclasses override if appropraite.


getUsableAlias

@Deprecated
public java.lang.String getUsableAlias()
Deprecated. - use getName()

Specified by:
getUsableAlias in interface AliasFragment

getName

public java.lang.String getName()
Returns a String that can be used to alias columns that depend on this fragment.

Specified by:
getName in interface DBObject
Specified by:
getName in interface AliasFragment
Overrides:
getName in class AbstractDBObject
Returns:
the alias if there is one or the expression. NOTE the expression may not be a valid alias depending on the flavour of SQL.

setName

public void setName(java.lang.String name)
Does nothing for this fragment - an alias fragment's name is derived from it's alias or expression.

Specified by:
setName in interface DBObject
Overrides:
setName in class AbstractDBObject
Parameters:
name - a string containing the new name for this object.

canUseAsAlias

protected boolean canUseAsAlias(java.lang.String exp)
Checks whether the given expression can be used as an alias.


copyToImpl

protected void copyToImpl(AbstractAliasFragment copy,
                          DBObject copyParent,
                          IDPolicy idPolicy)

equalsImpl

protected boolean equalsImpl(AbstractAliasFragment other)

toString

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

getOwnedObjectsImpl

protected void getOwnedObjectsImpl(java.util.Collection<DBObject> objs,
                                   java.lang.String... types)
Description copied from class: AbstractDBObject
Used by all the final children methods. Subclasses should start with super.getOwnedObjectsImpl(type) and then add to the passed list. Use includesType to check the types vararg.

Overrides:
getOwnedObjectsImpl in class AbstractDBObject
Parameters:
objs - a Collection of the apppropriate children.
types - a vararg of the type(s) to search for
See Also:
AbstractDBObject.includesType(java.lang.String, java.lang.String...)

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

Copyright © 1997, 2010, Oracle. All rights reserved.