public abstract class AbstractNamingFactory extends Object implements NamingFactory
Modifier and Type | Field and Description |
---|---|
protected ClassLoaderResolver |
clr |
protected NamingCase |
namingCase |
protected NucleusContext |
nucCtx |
protected String |
quoteString
Quote used when the identifier case selected requires it.
|
protected String |
wordSeparator
Separator to use for words in the identifiers.
|
Constructor and Description |
---|
AbstractNamingFactory(NucleusContext nucCtx) |
Modifier and Type | Method and Description |
---|---|
String |
getColumnName(AbstractMemberMetaData mmd,
ColumnType type)
Method to return the name of the column for the specified field.
|
String |
getIndexName(AbstractClassMetaData cmd,
IndexMetaData idxmd,
int position)
Method to return the name of an index specified at class level.
|
String |
getIndexName(AbstractMemberMetaData mmd,
IndexMetaData idxmd)
Method to return the name of an index specified at member level.
|
protected int |
getMaximumLengthForComponent(SchemaComponent cmpt) |
protected String |
getNameInRequiredCase(String name)
Convenience method to convert the passed name into a name in the required "case".
|
String |
getTableName(AbstractClassMetaData cmd)
Method to return the name of the table for the specified class.
|
protected String |
prepareColumnNameForUse(String name) |
NamingFactory |
setMaximumLength(SchemaComponent cmpt,
int max)
Method to set the maximum length of the name of the specified schema component.
|
NamingFactory |
setNamingCase(NamingCase nameCase)
Method to set the required case of the names.
|
NamingFactory |
setQuoteString(String quote)
Method to set the quote string to use (when the identifiers need to be quoted).
|
NamingFactory |
setWordSeparator(String sep)
Method to set the word separator of the names.
|
protected static String |
truncate(String name,
int length)
Method to truncate a name to fit within the specified name length.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getColumnName, getColumnName, getTableName
protected String wordSeparator
protected String quoteString
protected NamingCase namingCase
protected NucleusContext nucCtx
protected ClassLoaderResolver clr
public AbstractNamingFactory(NucleusContext nucCtx)
public NamingFactory setQuoteString(String quote)
NamingFactory
setIdentifierCase.
setQuoteString
in interface NamingFactory
quote
- The quote stringpublic NamingFactory setWordSeparator(String sep)
NamingFactory
setWordSeparator
in interface NamingFactory
sep
- Separatorpublic NamingFactory setNamingCase(NamingCase nameCase)
NamingFactory
setNamingCase
in interface NamingFactory
nameCase
- Required casepublic NamingFactory setMaximumLength(SchemaComponent cmpt, int max)
NamingFactory
setMaximumLength
in interface NamingFactory
cmpt
- The componentmax
- The maximum it acceptsprotected int getMaximumLengthForComponent(SchemaComponent cmpt)
public String getTableName(AbstractClassMetaData cmd)
NamingFactory
getTableName
in interface NamingFactory
cmd
- Metadata for the classpublic String getColumnName(AbstractMemberMetaData mmd, ColumnType type)
NamingFactory
getColumnNamemethod.
getColumnName
in interface NamingFactory
mmd
- Metadata for the fieldtype
- Type of columnpublic String getIndexName(AbstractClassMetaData cmd, IndexMetaData idxmd, int position)
NamingFactory
getIndexName
in interface NamingFactory
cmd
- Metadata for the classidxmd
- The index metadataposition
- Number of the index at class level (first is 0)public String getIndexName(AbstractMemberMetaData mmd, IndexMetaData idxmd)
NamingFactory
getIndexName
in interface NamingFactory
mmd
- Metadata for the memberidxmd
- The index metadataprotected static String truncate(String name, int length)
TRUNCATE_HASH_LENGTH
) (at the end) to attempt
to create uniqueness.name
- The namelength
- The (max) length to useprotected String getNameInRequiredCase(String name)
name
- The nameCopyright © 2021. All rights reserved.