Top Description Fields Constructors Methods
org.eclipse.persistence.internal.helper

public Class DatabaseTable

extends Object
implements CoreTable, Cloneable, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.lang.Cloneable, org.eclipse.persistence.internal.core.helper.CoreTable
Known Direct Subclasses
org.eclipse.persistence.internal.history.DecoratedDatabaseTable, org.eclipse.persistence.internal.history.HistoricalDatabaseTable, org.eclipse.persistence.internal.expressions.NestedTable, org.eclipse.persistence.internal.expressions.SubSelectDatabaseTable
Imports
java.io.*, java.util.ArrayList, .HashMap, .List, .Map, org.eclipse.persistence.internal.core.helper.CoreTable, org.eclipse.persistence.internal.databaseaccess.*, org.eclipse.persistence.internal.expressions.ExpressionSQLPrinter, org.eclipse.persistence.tools.schemaframework.ForeignKeyConstraint, .IndexDefinition

INTERNAL:

Purpose: Define a fully qualified table name.

Responsibilities:

See Also
DatabaseField

Field Summary

Modifier and TypeField and Description
protected String
protected Map<String, ForeignKeyConstraint>
foreignKeyConstraints

JPA 2.1 Foreign key specification data

protected List<IndexDefinition>
indexes

Store the set of indexes defined through meta-data for the table.

protected String
protected String
protected String
protected Map<String, List<List<String>>>
uniqueConstraints

Contains the user specified unique constraints.

protected boolean

Constructor Summary

AccessConstructor and Description
public
DatabaseTable()

Initialize the newly allocated instance of this class.

public
DatabaseTable(String possiblyQualifiedName)

public
DatabaseTable(String possiblyQualifiedName, String startDelimiter, String endDelimiter)

public
DatabaseTable(String tableName, String qualifier)

public
DatabaseTable(String tableName, String qualifier, boolean useDelimiters, String startDelimiter, String endDelimiter)

Method Summary

Modifier and TypeMethod and Description
public void
public void
addIndex(IndexDefinition index)

Add an index definition to this table.

public void
addUniqueConstraints(String name, List<String> columnNames)

Add the unique constraint for the columns names.

public DatabaseTable
clone()

Overrides java.lang.Object.clone.

Return a shallow copy of the receiver.
public boolean
equals(Object
the reference object with which to compare.
object
)

Overrides java.lang.Object.equals.

Two tables are equal if their names and tables are equal, or their names are equal and one does not have a qualifier assigned.
public boolean
equals(DatabaseTable table)

Two tables are equal if their names and tables are equal, or their names are equal and one does not have a qualifier assigned.

public String
getCreationSuffix()

returns the suffix applied to the CREATE table statement on this field for DDL generation.

public ForeignKeyConstraint
public Map<String, ForeignKeyConstraint>
public List<IndexDefinition>
getIndexes()

Return a list of index definitions.

public String
getName()

Get method for table name.

public String
getNameDelimited(DatasourcePlatform platform)

Get method for table name.

public String
public String
public String
public String
public Map<String, List<List<String>>>
getUniqueConstraints()

Return a list of the unique constraints for this table.

public boolean
public int
hashCode()

Overrides java.lang.Object.hashCode.

Return the hashcode of the name, because it is fairly unique.
public boolean
public boolean
hasName()

Determine whether the receiver has any identification information.

public boolean
public boolean
isDecorated()

INTERNAL: Is this decorated / has an AS OF (some past time) clause.

public void
printSQL(ExpressionSQLPrinter printer)

Print the table's SQL from clause.

protected void
public void
setCreationSuffix(String creationSuffix)

public void
setName(String name)

Set the table name.

public void
setName(String name, String startDelimiter, String endDelimiter)

Set the table name.

public void
setPossiblyQualifiedName(String possiblyQualifiedName)

Used to map the project xml.

public void
setPossiblyQualifiedName(String possiblyQualifiedName, String startDelimiter, String endDelimiter)

public void
public void
setTableQualifier(String qualifier, String startDelimiter, String endDelimiter)

public void
setUseDelimiters(boolean useDelimiters)

public boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
finalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

creationSuffixback to summary
protected String creationSuffix
foreignKeyConstraintsback to summary
protected Map<String, ForeignKeyConstraint> foreignKeyConstraints

JPA 2.1 Foreign key specification data

indexesback to summary
protected List<IndexDefinition> indexes

Store the set of indexes defined through meta-data for the table.

nameback to summary
protected String name
qualifiedNameback to summary
protected String qualifiedName
tableQualifierback to summary
protected String tableQualifier
uniqueConstraintsback to summary
protected Map<String, List<List<String>>> uniqueConstraints

Contains the user specified unique constraints. JPA 2.0 introduced the name element, therefore, if specified we will use that name to create the constraint. Constraints with no name will be added to the map under the null key and generated with a default name. Therefore, when a name is given the list size should only ever be 1. We will validate. The null key could have multiples however they will have their names defaulted (as we did before).

useDelimitersback to summary
protected boolean useDelimiters

Constructor Detail

DatabaseTableback to summary
public DatabaseTable()

Initialize the newly allocated instance of this class. By default their is no qualifier.

DatabaseTableback to summary
public DatabaseTable(String possiblyQualifiedName)
DatabaseTableback to summary
public DatabaseTable(String possiblyQualifiedName, String startDelimiter, String endDelimiter)
DatabaseTableback to summary
public DatabaseTable(String tableName, String qualifier)
DatabaseTableback to summary
public DatabaseTable(String tableName, String qualifier, boolean useDelimiters, String startDelimiter, String endDelimiter)

Method Detail

addForeignKeyConstraintback to summary
public void addForeignKeyConstraint(ForeignKeyConstraint foreignKeyConstraint)
addIndexback to summary
public void addIndex(IndexDefinition index)

Add an index definition to this table.

addUniqueConstraintsback to summary
public void addUniqueConstraints(String name, List<String> columnNames)

Add the unique constraint for the columns names. Used for DDL generation. For now we just add all the unique constraints as we would have before when we didn't have a name.

cloneback to summary
public DatabaseTable clone()

Overrides java.lang.Object.clone.

Return a shallow copy of the receiver.

Returns:DatabaseTable

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
equalsback to summary
public boolean equals(Object object)

Overrides java.lang.Object.equals.

Two tables are equal if their names and tables are equal, or their names are equal and one does not have a qualifier assigned. This allows an unqualified table to equal the same fully qualified one.

Parameters
object:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
equalsback to summary
public boolean equals(DatabaseTable table)

Two tables are equal if their names and tables are equal, or their names are equal and one does not have a qualifier assigned. This allows an unqualified table to equal the same fully qualified one.

getCreationSuffixback to summary
public String getCreationSuffix()

returns the suffix applied to the CREATE table statement on this field for DDL generation.

getForeignKeyConstraintback to summary
public ForeignKeyConstraint getForeignKeyConstraint(String name)
getForeignKeyConstraintsback to summary
public Map<String, ForeignKeyConstraint> getForeignKeyConstraints()
getIndexesback to summary
public List<IndexDefinition> getIndexes()

Return a list of index definitions. Used for DDL generation.

getNameback to summary
public String getName()

Get method for table name.

getNameDelimitedback to summary
public String getNameDelimited(DatasourcePlatform platform)

Get method for table name.

getQualifiedNameback to summary
public String getQualifiedName()
getQualifiedNameDelimitedback to summary
public String getQualifiedNameDelimited(DatasourcePlatform platform)
getTableQualifierback to summary
public String getTableQualifier()
getTableQualifierDelimitedback to summary
public String getTableQualifierDelimited(DatasourcePlatform platform)
getUniqueConstraintsback to summary
public Map<String, List<List<String>>> getUniqueConstraints()

Return a list of the unique constraints for this table. Used for DDL generation.

hasForeignKeyConstraintsback to summary
public boolean hasForeignKeyConstraints()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Return the hashcode of the name, because it is fairly unique.

Returns:int

Doc from java.lang.Object.hashCode.

a hash code value for this object.

Annotations
@Override
hasIndexesback to summary
public boolean hasIndexes()
hasNameback to summary
public boolean hasName()

Determine whether the receiver has any identification information. Return true if the name or qualifier of the receiver are nonempty.

hasUniqueConstraintsback to summary
public boolean hasUniqueConstraints()
isDecoratedback to summary
public boolean isDecorated()

INTERNAL: Is this decorated / has an AS OF (some past time) clause. Example: SELECT ... FROM EMPLOYEE AS OF TIMESTAMP (exp) t0 ...

printSQLback to summary
public void printSQL(ExpressionSQLPrinter printer) throws IOException

Print the table's SQL from clause.

resetQualifiedNameback to summary
protected void resetQualifiedName()
setCreationSuffixback to summary
public void setCreationSuffix(String creationSuffix)
setNameback to summary
public void setName(String name)

Set the table name. Used when aliasing table names.

setNameback to summary
public void setName(String name, String startDelimiter, String endDelimiter)

Set the table name. Used when aliasing table names. If the name contains database delimiters, they will be stripped and a flag will be set to have them added when the DatabaseTable is written to SQL

setPossiblyQualifiedNameback to summary
public void setPossiblyQualifiedName(String possiblyQualifiedName)

Used to map the project xml. Any time a string name is read from the project xml, we must check if it is fully qualified and split the actual name from the qualifier.

setPossiblyQualifiedNameback to summary
public void setPossiblyQualifiedName(String possiblyQualifiedName, String startDelimiter, String endDelimiter)
setTableQualifierback to summary
public void setTableQualifier(String qualifier)
setTableQualifierback to summary
public void setTableQualifier(String qualifier, String startDelimiter, String endDelimiter)
setUseDelimitersback to summary
public void setUseDelimiters(boolean useDelimiters)
shouldUseDelimitersback to summary
public boolean shouldUseDelimiters()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override