org.apache.openjpa.jdbc.identifier
Class QualifiedDBIdentifier

java.lang.Object
  extended by org.apache.openjpa.lib.identifier.IdentifierImpl
      extended by org.apache.openjpa.jdbc.identifier.DBIdentifier
          extended by org.apache.openjpa.jdbc.identifier.QualifiedDBIdentifier
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Identifier>, Identifier

public class QualifiedDBIdentifier
extends DBIdentifier
implements Identifier, Cloneable, Serializable

This class extends DBIdentifier to provide support for qualified identifiers such as schema qualified tables and table qualified columns. It provides methods to create qualified identifiers from individual identifiers.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.openjpa.jdbc.identifier.DBIdentifier
DBIdentifier.DBIdentifierType
 
Field Summary
 
Fields inherited from class org.apache.openjpa.jdbc.identifier.DBIdentifier
_ignoreCase, NULL
 
Constructor Summary
protected QualifiedDBIdentifier(DBIdentifier... sNames)
           
 
Method Summary
 QualifiedDBIdentifier clone()
          Creates a clone of this identifier.
 int compareTo(Identifier o)
          Compares this identifier with another identifier.
 boolean equals(Object obj)
          Equality operator.
 String getBaseName()
          Returns the base name of this qualified name.
 DBIdentifier getIdentifier()
          Returns this object as a DBIdentifier.
 String getName()
          Returns the fully qualified name as a string
 DBIdentifier getObjectTableName()
          Gets the object table name component of the path, if the path is a table qualified identifier such as a constraint or column.
static QualifiedDBIdentifier getPath(DBIdentifier sName)
          Creates a qualified path from an identifier.
 DBIdentifier getSchemaName()
          Gets the schema component of the path.
 DBIdentifier getUnqualifiedName()
          Returns a new unqualified name based on this instance.
 boolean isDelimited()
          Returns true if all identifiers within this compound identifier are delimited.
 boolean isUnqualifiedColumn()
          Returns true if this object is not qualified by a table or schema component.
 boolean isUnqualifiedObject()
          Returns true if this object is not qualified by a schema component.
 int length()
          Returns the length of the qualified identifier, including delimiters and name separators.
static QualifiedDBIdentifier newPath(DBIdentifier... names)
          Creates a qualified identifier based upon an array of DBIdentifiers.
static boolean pathEqual(QualifiedDBIdentifier path1, QualifiedDBIdentifier path2)
          Compares two qualified identifiers for equality.
protected  void setBaseName(String name)
          Set the base name component of this compound identifier
 void setName(String name)
          Set the name of this qualified identifier.
 void setObjectTableName(DBIdentifier objectName)
          Sets the object table name component of the path, if the path is a table qualified identifier such as a constraint or column.
 void setPath(DBIdentifier... sNames)
          Set the identifiers that make up the path.
 void setSchemaName(DBIdentifier schemaName)
          Sets the schema component of the path.
static DBIdentifier[] splitPath(DBIdentifier sName)
          Splits a qualified path into separate identifiers.
 String toString()
          Returns a fully qualified name as a string.
 
Methods inherited from class org.apache.openjpa.jdbc.identifier.DBIdentifier
append, combine, combine, equal, equalsIgnoreCase, equalsIgnoreCase, getIgnoreCase, getType, isEmpty, isNull, isNull, join, newCatalog, newCatalog, newColumn, newColumn, newColumnDefinition, newConstant, newConstraint, newConstraint, newDefault, newForeignKey, newForeignKey, newIdentifier, newIdentifier, newIdentifier, newIdentifier, newIndex, newIndex, newSchema, newSchema, newSequence, newSequence, newTable, newTable, preCombine, removeDelimiters, removeHungarianNotation, removeLeading, setIgnoreCase, setName, setName, setType, split, split, toArray, toArray, toLower, toLower, toStringArray, toUpper, toUpper, trim, trimToNull, truncate
 
Methods inherited from class org.apache.openjpa.lib.identifier.IdentifierImpl
hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QualifiedDBIdentifier

protected QualifiedDBIdentifier(DBIdentifier... sNames)
Method Detail

newPath

public static QualifiedDBIdentifier newPath(DBIdentifier... names)
Creates a qualified identifier based upon an array of DBIdentifiers. Identifiers must be specified in order.

Parameters:
names -
Returns:

setPath

public void setPath(DBIdentifier... sNames)
Set the identifiers that make up the path. Identifiers must be specified in path order. (ex. [ table, column ] )

Parameters:
sNames -

splitPath

public static DBIdentifier[] splitPath(DBIdentifier sName)
Splits a qualified path into separate identifiers.

Parameters:
sName -
Returns:

getPath

public static QualifiedDBIdentifier getPath(DBIdentifier sName)
Creates a qualified path from an identifier.

Parameters:
sName -
Returns:

setSchemaName

public void setSchemaName(DBIdentifier schemaName)
Sets the schema component of the path.


getSchemaName

public DBIdentifier getSchemaName()
Gets the schema component of the path.

Returns:

setObjectTableName

public void setObjectTableName(DBIdentifier objectName)
Sets the object table name component of the path, if the path is a table qualified identifier such as a constraint or column.


getObjectTableName

public DBIdentifier getObjectTableName()
Gets the object table name component of the path, if the path is a table qualified identifier such as a constraint or column.


isUnqualifiedObject

public boolean isUnqualifiedObject()
Returns true if this object is not qualified by a schema component.

Returns:

isUnqualifiedColumn

public boolean isUnqualifiedColumn()
Returns true if this object is not qualified by a table or schema component.

Returns:

equals

public boolean equals(Object obj)
Equality operator.

Overrides:
equals in class DBIdentifier

pathEqual

public static boolean pathEqual(QualifiedDBIdentifier path1,
                                QualifiedDBIdentifier path2)
Compares two qualified identifiers for equality.

Parameters:
path1 -
path2 -
Returns:

toString

public String toString()
Returns a fully qualified name as a string.

Overrides:
toString in class IdentifierImpl

getName

public String getName()
Returns the fully qualified name as a string

Specified by:
getName in interface Identifier
Overrides:
getName in class IdentifierImpl

getBaseName

public String getBaseName()
Returns the base name of this qualified name. For example, if the qualified name is a schema qualified table, the table name is returned.

Returns:

getIdentifier

public DBIdentifier getIdentifier()
Returns this object as a DBIdentifier.

Returns:

setName

public void setName(String name)
Set the name of this qualified identifier. Splits the string into multiple components. This method assumes the type does not change.

Specified by:
setName in interface Identifier
Overrides:
setName in class DBIdentifier

setBaseName

protected void setBaseName(String name)
Set the base name component of this compound identifier

Parameters:
name -

length

public int length()
Returns the length of the qualified identifier, including delimiters and name separators.

Specified by:
length in interface Identifier
Overrides:
length in class DBIdentifier

compareTo

public int compareTo(Identifier o)
Compares this identifier with another identifier.

Specified by:
compareTo in interface Comparable<Identifier>
Overrides:
compareTo in class DBIdentifier

isDelimited

public boolean isDelimited()
Returns true if all identifiers within this compound identifier are delimited. Otherwise, false.

Overrides:
isDelimited in class DBIdentifier

getUnqualifiedName

public DBIdentifier getUnqualifiedName()
Returns a new unqualified name based on this instance.

Overrides:
getUnqualifiedName in class DBIdentifier

clone

public QualifiedDBIdentifier clone()
Creates a clone of this identifier.

Overrides:
clone in class DBIdentifier


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.