|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.store.mapped.identifier.AbstractIdentifierFactory
org.datanucleus.store.mapped.identifier.DNIdentifierFactory
public class DNIdentifierFactory
Factory that creates immutable instances of DatastoreIdentifier for mapped datastores. Includes a "JPOX" naming strategy, naming as follows
| Field Summary | |
|---|---|
protected String |
tablePrefix
Prefix for all generated table names. |
protected String |
tableSuffix
Suffix for all generated table names. |
| Fields inherited from class org.datanucleus.store.mapped.identifier.AbstractIdentifierFactory |
|---|
candidates, CASE_LOWER, CASE_PRESERVE, CASE_UPPER, clr, columns, dba, defaultCatalogName, defaultSchemaName, foreignkeys, identifierCase, indexes, LOCALISER, primarykeys, quoteString, rdba, references, sequences, tables, wordSeparator |
| Constructor Summary | |
|---|---|
DNIdentifierFactory(DatastoreAdapter dba,
ClassLoaderResolver clr,
Map props)
Constructor. |
|
| Method Summary | |
|---|---|
String |
generateIdentifierNameForJavaName(String javaName)
Generate a datastore identifier from a Java identifier. |
protected String |
getColumnIdentifierSuffix(int role,
boolean embedded)
Accessor for the suffix to add to any column identifier, based on the role type. |
DatastoreIdentifier |
newAdapterIndexFieldIdentifier()
Method to return an identifier for an adapter index datastore field. |
DatastoreIdentifier |
newDatastoreContainerIdentifier(AbstractClassMetaData cmd)
Method to return a Table identifier for the specified class. |
DatastoreIdentifier |
newDatastoreContainerIdentifier(AbstractMemberMetaData fmd)
Method to return a Table identifier for the join table of the specified field. |
DatastoreIdentifier |
newDiscriminatorFieldIdentifier()
Method to return an identifier for a discriminator column. |
DatastoreIdentifier |
newForeignKeyFieldIdentifier(AbstractMemberMetaData ownerFmd,
AbstractMemberMetaData relatedFmd,
DatastoreIdentifier destinationId,
boolean embedded,
int fieldRole)
Method to generate a FK/FK-index field identifier. |
DatastoreIdentifier |
newIndexFieldIdentifier(AbstractMemberMetaData mmd)
Method to return an identifier for an index (ordering) datastore field. |
DatastoreIdentifier |
newJoinTableFieldIdentifier(AbstractMemberMetaData ownerFmd,
AbstractMemberMetaData relatedFmd,
DatastoreIdentifier destinationId,
boolean embedded,
int fieldRole)
Method to generate a join-table identifier. |
DatastoreIdentifier |
newReferenceFieldIdentifier(AbstractMemberMetaData refMetaData,
AbstractClassMetaData implMetaData,
DatastoreIdentifier implIdentifier,
boolean embedded,
int fieldRole)
Method to generate an identifier name for reference field, based on the metadata for the field, and the ClassMetaData for the implementation. |
DatastoreIdentifier |
newVersionFieldIdentifier()
Method to return an identifier for a version datastore field. |
| Methods inherited from class org.datanucleus.store.mapped.identifier.AbstractIdentifierFactory |
|---|
getDatastoreAdapter, getIdentifierCase, getIdentifierInAdapterCase, getIdentifierNamePartsFromName, getWordSeparator, newCandidateKeyIdentifier, newDatastoreContainerIdentifier, newDatastoreFieldIdentifier, newDatastoreFieldIdentifier, newForeignKeyIdentifier, newIdentifier, newIdentifier, newIndexIdentifier, newPrimaryKeyIdentifier, newSequenceIdentifier, setCatalogSchemaForTable, truncate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected String tablePrefix
protected String tableSuffix
| Constructor Detail |
|---|
public DNIdentifierFactory(DatastoreAdapter dba,
ClassLoaderResolver clr,
Map props)
dba - Database adapterclr - ClassLoader resolverprops - Any properties controlling identifier generation| Method Detail |
|---|
public DatastoreIdentifier newDatastoreContainerIdentifier(AbstractMemberMetaData fmd)
fmd - Meta data for the field
public DatastoreIdentifier newDatastoreContainerIdentifier(AbstractClassMetaData cmd)
cmd - Meta data for the class
public DatastoreIdentifier newReferenceFieldIdentifier(AbstractMemberMetaData refMetaData,
AbstractClassMetaData implMetaData,
DatastoreIdentifier implIdentifier,
boolean embedded,
int fieldRole)
refMetaData - the metadata for the reference fieldimplMetaData - the AbstractClassMetaData for this implementationimplIdentifier - PK identifier for the implementationembedded - Whether the identifier is for a field embeddedfieldRole - The role to be performed by this column e.g FK, collection element ?
public DatastoreIdentifier newJoinTableFieldIdentifier(AbstractMemberMetaData ownerFmd,
AbstractMemberMetaData relatedFmd,
DatastoreIdentifier destinationId,
boolean embedded,
int fieldRole)
ownerFmd - MetaData for the owner fieldrelatedFmd - MetaData for the related fielddestinationId - Identifier for the identity field of the destination (if FK)embedded - Whether the identifier is for a field embeddedfieldRole - The role to be performed by this column e.g FK, collection element ?
public DatastoreIdentifier newForeignKeyFieldIdentifier(AbstractMemberMetaData ownerFmd,
AbstractMemberMetaData relatedFmd,
DatastoreIdentifier destinationId,
boolean embedded,
int fieldRole)
ownerFmd - MetaData for the owner fieldrelatedFmd - MetaData for the related fielddestinationId - Identifier for the identity field of the destination table (if strict FK)embedded - Whether the identifier is for a field embeddedfieldRole - The role to be performed by this column e.g owner, index ?
public DatastoreIdentifier newDiscriminatorFieldIdentifier()
public DatastoreIdentifier newVersionFieldIdentifier()
public DatastoreIdentifier newAdapterIndexFieldIdentifier()
public DatastoreIdentifier newIndexFieldIdentifier(AbstractMemberMetaData mmd)
mmd - MetaData for the field/property - not used here
public String generateIdentifierNameForJavaName(String javaName)
Conversion consists of breaking the identifier into words, converting each word to upper-case, and separating each one with a word separator. Words are identified by a leading upper-case character. Any leading or trailing underscores are removed.
generateIdentifierNameForJavaName in class AbstractIdentifierFactoryjavaName - the Java identifier.
protected String getColumnIdentifierSuffix(int role,
boolean embedded)
getColumnIdentifierSuffix in class AbstractIdentifierFactoryrole - Datastore field roleembedded - Whether the DatastoreField is stored embedded
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||