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 Set<String> |
reservedWords |
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 |
getColumnName(List<AbstractMemberMetaData> mmds,
int colPosition)
Method to return the name of the column for the position of the specified EMBEDDED field, within the specified owner field.
|
String |
getConstraintName(AbstractClassMetaData cmd,
ConstraintMetaData cnstrmd,
ColumnType type)
Method to return the name of the constraint for the specified class (version, datastore-id, discriminator etc).
|
String |
getConstraintName(AbstractClassMetaData cmd,
ConstraintMetaData cnstrmd,
int position)
Method to return the name of a constraint specified at class level.
|
String |
getConstraintName(String className,
AbstractMemberMetaData mmd,
ConstraintMetaData cnstrmd)
Method to return the name of a constraint 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 |
getSequenceName(SequenceMetaData seqmd)
Method to return the name of sequence.
|
String |
getTableName(AbstractClassMetaData cmd)
Method to return the name of the table for the specified class.
|
protected String |
prepareIdentifierNameForUse(String name,
SchemaComponent cmpt)
Convenience method that will truncate the provided name if it is longer than the longest possible for the specified schema component,
and then convert it into the required case.
|
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 |
setReservedKeywords(Set<String> keywords)
Method to set the provided list of keywords as names that identifiers have to surround by quotes to use.
|
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, waitgetColumnName, getColumnName, getTableNameprotected String wordSeparator
protected String quoteString
protected NamingCase namingCase
protected NucleusContext nucCtx
protected ClassLoaderResolver clr
public AbstractNamingFactory(NucleusContext nucCtx)
public NamingFactory setReservedKeywords(Set<String> keywords)
NamingFactorysetReservedKeywords in interface NamingFactorykeywords - The keywordspublic NamingFactory setQuoteString(String quote)
NamingFactorysetIdentifierCase.
setQuoteString in interface NamingFactoryquote - The quote stringpublic NamingFactory setWordSeparator(String sep)
NamingFactorysetWordSeparator in interface NamingFactorysep - Separatorpublic NamingFactory setNamingCase(NamingCase nameCase)
NamingFactorysetNamingCase in interface NamingFactorynameCase - Required casepublic NamingFactory setMaximumLength(SchemaComponent cmpt, int max)
NamingFactorysetMaximumLength in interface NamingFactorycmpt - The componentmax - The maximum it acceptsprotected int getMaximumLengthForComponent(SchemaComponent cmpt)
public String getTableName(AbstractClassMetaData cmd)
NamingFactorygetTableName in interface NamingFactorycmd - Metadata for the classpublic String getColumnName(AbstractMemberMetaData mmd, ColumnType type)
NamingFactorygetColumnNamemethod.
getColumnName in interface NamingFactorymmd - Metadata for the fieldtype - Type of columnpublic String getColumnName(List<AbstractMemberMetaData> mmds, int colPosition)
NamingFactorygetColumnName in interface NamingFactorymmds - MetaData for the field(s) with the column. The first value is the original field that is embedded, followed by fields of the embedded object(s).colPosition - The position of the column (where this field has multiple columns)public String getConstraintName(AbstractClassMetaData cmd, ConstraintMetaData cnstrmd, int position)
NamingFactorygetConstraintName in interface NamingFactorycmd - Metadata for the classcnstrmd - The constraint metadataposition - Number of the constraint at class level (first is 0)public String getConstraintName(String className, AbstractMemberMetaData mmd, ConstraintMetaData cnstrmd)
NamingFactorygetConstraintName in interface NamingFactoryclassName - Name of the class that this constraint is for.mmd - Metadata for the membercnstrmd - The constraint metadatapublic String getConstraintName(AbstractClassMetaData cmd, ConstraintMetaData cnstrmd, ColumnType type)
NamingFactorygetConstraintName in interface NamingFactorycmd - Metadata for the classcnstrmd - The constraint metadatatype - Column typepublic String getSequenceName(SequenceMetaData seqmd)
NamingFactorygetSequenceName in interface NamingFactoryseqmd - Metadata for the sequenceprotected 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 nameprotected String prepareIdentifierNameForUse(String name, SchemaComponent cmpt)
name - The namecmpt - The schema component that it is forCopyright © 2016. All rights reserved.