org.datanucleus.store.mapped.identifier
Class DatastoreIdentifierImpl

java.lang.Object
  extended by org.datanucleus.store.mapped.identifier.DatastoreIdentifierImpl
All Implemented Interfaces:
DatastoreIdentifier

public class DatastoreIdentifierImpl
extends java.lang.Object
implements DatastoreIdentifier

Implementation of a datastore identifier. This can be something like a table name, column name, PK name, etc.


Field Summary
protected  java.lang.String catalogName
          catalog name.
protected  DatastoreAdapter dba
          Datastore adapter
protected  IdentifierFactory factory
          Datastore Identifier factory.
protected  java.lang.String identifierName
          The identifier name.
protected  java.lang.String schemaName
          schema/owner name.
 
Constructor Summary
protected DatastoreIdentifierImpl(IdentifierFactory factory, java.lang.String sqlIdentifier)
          Constructor.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Equality operator to judge if 2 identifiers are equal.
 java.lang.String getCatalogName()
          Accessor for the catalog name
 java.lang.String getFullyQualifiedName(boolean adapterCase)
          Accessor for a fully-qualified version of the identifier name.
 java.lang.String getIdentifierName()
          Accessor for the identifier name part of the identifier.
 java.lang.String getSchemaName()
          Accessor for the schema name
 int hashCode()
          Hash code method.
 void setCatalogName(java.lang.String catalogName)
          Sets the catalog name
 void setSchemaName(java.lang.String schemaName)
          Sets the schema name
protected  java.lang.String toCase(java.lang.String identifierName)
          Mutator for the sql identifier.
 java.lang.String toString()
          Method to output the name of the identifier.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

dba

protected final DatastoreAdapter dba
Datastore adapter


factory

protected final IdentifierFactory factory
Datastore Identifier factory.


identifierName

protected java.lang.String identifierName
The identifier name.


catalogName

protected java.lang.String catalogName
catalog name.


schemaName

protected java.lang.String schemaName
schema/owner name.

Constructor Detail

DatastoreIdentifierImpl

protected DatastoreIdentifierImpl(IdentifierFactory factory,
                                  java.lang.String sqlIdentifier)
Constructor.

Parameters:
factory - Identifier factory
sqlIdentifier - The SQL identifier name
Method Detail

toCase

protected java.lang.String toCase(java.lang.String identifierName)
Mutator for the sql identifier. Takes account of the DB policy on upper, lower and mixed case identifiers. Optionally can truncate the identifier if it exceeds the "getMaxLength()".

Parameters:
identifierName - The Identifier

getIdentifierName

public java.lang.String getIdentifierName()
Accessor for the identifier name part of the identifier.

Specified by:
getIdentifierName in interface DatastoreIdentifier
Returns:
identifier name

setCatalogName

public void setCatalogName(java.lang.String catalogName)
Sets the catalog name

Specified by:
setCatalogName in interface DatastoreIdentifier
Parameters:
catalogName - The catalog name

setSchemaName

public void setSchemaName(java.lang.String schemaName)
Sets the schema name

Specified by:
setSchemaName in interface DatastoreIdentifier
Parameters:
schemaName - The schema name

getCatalogName

public java.lang.String getCatalogName()
Accessor for the catalog name

Specified by:
getCatalogName in interface DatastoreIdentifier
Returns:
The catalog name

getSchemaName

public java.lang.String getSchemaName()
Accessor for the schema name

Specified by:
getSchemaName in interface DatastoreIdentifier
Returns:
The schema name

hashCode

public int hashCode()
Hash code method.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code

equals

public boolean equals(java.lang.Object obj)
Equality operator to judge if 2 identifiers are equal. TODO change the below behavior. will require changing all places creating an identifier to set the catalog name and schema name from jdo metadata and/or metadata collected from the db

Overrides:
equals in class java.lang.Object
Parameters:
obj - Object to compare against
Returns:
Whether they are equal

toString

public java.lang.String toString()
Method to output the name of the identifier. This will be quoted where necessary. Will not include the catalog/schema names.

Specified by:
toString in interface DatastoreIdentifier
Overrides:
toString in class java.lang.Object
Returns:
The identifier name with any necessary quoting

getFullyQualifiedName

public final java.lang.String getFullyQualifiedName(boolean adapterCase)
Accessor for a fully-qualified version of the identifier name. Allows for catalog/schema (if specified and if supported)

Specified by:
getFullyQualifiedName in interface DatastoreIdentifier
Parameters:
adapterCase - Whether to use adapter case for the returned name
Returns:
The fully-qualified name


Copyright © 2010. All Rights Reserved.