Class DatastoreIdentifierImpl
- java.lang.Object
-
- org.datanucleus.store.rdbms.identifier.DatastoreIdentifierImpl
-
- All Implemented Interfaces:
DatastoreIdentifier
- Direct Known Subclasses:
CandidateKeyIdentifier,ColumnIdentifier,ForeignKeyIdentifier,IndexIdentifier,PrimaryKeyIdentifier,SequenceIdentifier,TableIdentifier
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
Fields Modifier and Type Field Description protected java.lang.StringcatalogNamecatalogprotected DatastoreAdapterdbaDatastore adapterprotected IdentifierFactoryfactoryDatastore Identifier factory.protected java.lang.StringnameThe name.protected java.lang.StringschemaNameschemaprivate java.lang.StringtoStringString representation to reduce number of times the toString is constructed
-
Constructor Summary
Constructors Modifier Constructor Description protectedDatastoreIdentifierImpl(IdentifierFactory factory, java.lang.String sqlIdentifier)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Equality operator to judge if 2 identifiers are equal.java.lang.StringgetCatalogName()Accessor for the catalogjava.lang.StringgetFullyQualifiedName(boolean adapterCase)Accessor for a fully-qualified version of the identifier name.java.lang.StringgetName()Accessor for the name.java.lang.StringgetSchemaName()Accessor for the schemainthashCode()Hash code method.voidsetCatalogName(java.lang.String catalogName)Sets the catalogvoidsetSchemaName(java.lang.String schemaName)Sets the schemaprotected java.lang.StringtoCase(java.lang.String identifierName)Mutator for the sql identifier.java.lang.StringtoString()Method to output the name of the identifier.
-
-
-
Field Detail
-
dba
protected final DatastoreAdapter dba
Datastore adapter
-
factory
protected final IdentifierFactory factory
Datastore Identifier factory.
-
name
protected java.lang.String name
The name.
-
catalogName
protected java.lang.String catalogName
catalog
-
schemaName
protected java.lang.String schemaName
schema
-
toString
private java.lang.String toString
String representation to reduce number of times the toString is constructed
-
-
Constructor Detail
-
DatastoreIdentifierImpl
protected DatastoreIdentifierImpl(IdentifierFactory factory, java.lang.String sqlIdentifier)
Constructor.- Parameters:
factory- Identifier factorysqlIdentifier- 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- Returns:
- The cased identifier
-
getName
public java.lang.String getName()
Accessor for the name.- Specified by:
getNamein interfaceDatastoreIdentifier- Returns:
- The name
-
setCatalogName
public void setCatalogName(java.lang.String catalogName)
Sets the catalog- Specified by:
setCatalogNamein interfaceDatastoreIdentifier- Parameters:
catalogName- The catalog
-
setSchemaName
public void setSchemaName(java.lang.String schemaName)
Sets the schema- Specified by:
setSchemaNamein interfaceDatastoreIdentifier- Parameters:
schemaName- The schema
-
getCatalogName
public java.lang.String getCatalogName()
Accessor for the catalog- Specified by:
getCatalogNamein interfaceDatastoreIdentifier- Returns:
- The catalog
-
getSchemaName
public java.lang.String getSchemaName()
Accessor for the schema- Specified by:
getSchemaNamein interfaceDatastoreIdentifier- Returns:
- The schema
-
hashCode
public int hashCode()
Hash code method.- Overrides:
hashCodein classjava.lang.Object- Returns:
- The hash code
-
equals
public boolean equals(java.lang.Object obj)
Equality operator to judge if 2 identifiers are equal.- Comparing NULL schema/owner names in one or both objects evaluates to true
- Comparing NULL catalog names in one or both objects evaluates to true
- Overrides:
equalsin classjava.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:
toStringin interfaceDatastoreIdentifier- Overrides:
toStringin classjava.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:
getFullyQualifiedNamein interfaceDatastoreIdentifier- Parameters:
adapterCase- Whether to use adapter case for the returned name- Returns:
- The fully-qualified name
-
-