-
- All Known Implementing Classes:
AbstractNamingFactory
,DN2NamingFactory
,JPANamingFactory
public interface NamingFactory
Representation of a naming factory for schema components (tables, columns, etc).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getColumnName(List<AbstractMemberMetaData> mmds, int position)
Method to return the name of the column for the position of the specified EMBEDDED field, within the specified owner field.String
getColumnName(AbstractClassMetaData cmd, ColumnType type)
Method to return the name of the column for the specified class (version, datastore-id, discriminator etc).String
getColumnName(AbstractMemberMetaData mmd, ColumnType type)
Method to return the name of the column for the specified field.String
getColumnName(AbstractMemberMetaData mmd, ColumnType type, int position)
Method to return the name of the column for the position of the specified field.String
getConstraintName(String className, AbstractMemberMetaData mmd, ConstraintMetaData cnstrmd)
Method to return the name of a constraint specified at member level.String
getConstraintName(AbstractClassMetaData cmd, ConstraintMetaData cnstrmd, int position)
Method to return the name of a constraint specified at class level.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
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.String
getTableName(AbstractMemberMetaData mmd)
Method to return the name of the (join) table for the specified field.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.
-
-
-
Method Detail
-
setReservedKeywords
NamingFactory setReservedKeywords(Set<String> keywords)
Method to set the provided list of keywords as names that identifiers have to surround by quotes to use.- Parameters:
keywords
- The keywords- Returns:
- This naming factory
-
setMaximumLength
NamingFactory setMaximumLength(SchemaComponent cmpt, int max)
Method to set the maximum length of the name of the specified schema component.- Parameters:
cmpt
- The componentmax
- The maximum it accepts- Returns:
- This naming factory
-
setQuoteString
NamingFactory setQuoteString(String quote)
Method to set the quote string to use (when the identifiers need to be quoted). SeesetIdentifierCase
.- Parameters:
quote
- The quote string- Returns:
- This naming factory
-
setWordSeparator
NamingFactory setWordSeparator(String sep)
Method to set the word separator of the names.- Parameters:
sep
- Separator- Returns:
- This naming factory
-
setNamingCase
NamingFactory setNamingCase(NamingCase nameCase)
Method to set the required case of the names.- Parameters:
nameCase
- Required case- Returns:
- This naming factory
-
getTableName
String getTableName(AbstractClassMetaData cmd)
Method to return the name of the table for the specified class.- Parameters:
cmd
- Metadata for the class- Returns:
- Name of the table
-
getTableName
String getTableName(AbstractMemberMetaData mmd)
Method to return the name of the (join) table for the specified field.- Parameters:
mmd
- Metadata for the field/property needing a join table- Returns:
- Name of the table
-
getColumnName
String getColumnName(AbstractClassMetaData cmd, ColumnType type)
Method to return the name of the column for the specified class (version, datastore-id, discriminator etc).- Parameters:
cmd
- Metadata for the classtype
- Column type- Returns:
- Name of the column
-
getColumnName
String getColumnName(AbstractMemberMetaData mmd, ColumnType type)
Method to return the name of the column for the specified field. If you have multiple columns for a field then call the othergetColumnName
method.- Parameters:
mmd
- Metadata for the fieldtype
- Type of column- Returns:
- The column name
-
getColumnName
String getColumnName(AbstractMemberMetaData mmd, ColumnType type, int position)
Method to return the name of the column for the position of the specified field. Normally the position will be 0 since most fields map to a single column, but where you have a FK to an object with composite id, or where the Java type maps to multiple columns then the position is used.- Parameters:
mmd
- Metadata for the fieldtype
- Type of columnposition
- Position of the column- Returns:
- The column name
-
getColumnName
String getColumnName(List<AbstractMemberMetaData> mmds, int position)
Method to return the name of the column for the position of the specified EMBEDDED field, within the specified owner field. For example, say we have a class Type1 with field "field1" that is marked as embedded, and this is of type Type2. In turn Type2 has a field "field2" that is also embedded, of type Type3. Type3 has a field "name". So to get the column name for Type3.name in the table for Type1 we call "getColumnName({mmdForField1InType1, mmdForField2InType2, mmdForNameInType3}, 0)".- Parameters:
mmds
- 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).position
- The position of the column (where this field has multiple columns)- Returns:
- The column name TODO Pass in something that distinguishes between map key and map value
-
getConstraintName
String getConstraintName(AbstractClassMetaData cmd, ConstraintMetaData cnstrmd, int position)
Method to return the name of a constraint specified at class level.- Parameters:
cmd
- Metadata for the classcnstrmd
- The constraint metadataposition
- Number of the constraint at class level (first is 0)- Returns:
- Name of the constraint
-
getConstraintName
String getConstraintName(String className, AbstractMemberMetaData mmd, ConstraintMetaData cnstrmd)
Method to return the name of a constraint specified at member level.- Parameters:
className
- Name of the class that this constraint is for.mmd
- Metadata for the membercnstrmd
- The constraint metadata- Returns:
- Name of the constraint
-
getConstraintName
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).- Parameters:
cmd
- Metadata for the classcnstrmd
- The constraint metadatatype
- Column type- Returns:
- Name of the constraint
-
getSequenceName
String getSequenceName(SequenceMetaData seqmd)
Method to return the name of sequence.- Parameters:
seqmd
- Metadata for the sequence- Returns:
- Name of the sequence
-
-