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

E13403-08

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.
 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.
 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 expression)
          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, getProperty, setProperty
 
Methods inherited from class oracle.javatools.db.AbstractDBObject
changeParent, compareToImpl, copyObject, copyTo, copyTo, copyTo, copyTo, equals, equalsImpl, findOwnedObject, findOwnedObject, findOwnedObject, getChildSupport, getID, getOwnedObjects, getOwnedObjects, getOwnedObjectsImpl, getProperties, getProperty, getReferenceIDs, getReferenceIDsImpl, hashCode, includeOwnedObject, includesType, includesType, removeThisAsParent, replaceReferenceIDs, setID, setProperties
 
Methods inherited from class java.lang.Object
clone, 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 expression)
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.


toString

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

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

E13403-08

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