Interface NamingFactory
- All Known Implementing Classes:
AbstractNamingFactory
,DN2NamingFactory
,JPANamingFactory
public interface NamingFactory
Representation of a naming factory for schema components (tables, columns, etc).
-
Method Summary
Modifier and TypeMethodDescriptiongetColumnName
(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.getColumnName
(AbstractClassMetaData cmd, ColumnType type) Method to return the name of the column for the specified class (version, datastore-id, discriminator etc).getColumnName
(AbstractMemberMetaData mmd, ColumnType type) Method to return the name of the column for the specified field.getColumnName
(AbstractMemberMetaData mmd, ColumnType type, int position) Method to return the name of the column for the position of the specified field.getConstraintName
(String className, AbstractMemberMetaData mmd, ConstraintMetaData cnstrmd) Method to return the name of a constraint specified at member level.getConstraintName
(AbstractClassMetaData cmd, ConstraintMetaData cnstrmd, int position) Method to return the name of a constraint specified at class level.getConstraintName
(AbstractClassMetaData cmd, ConstraintMetaData cnstrmd, ColumnType type) Method to return the name of the constraint for the specified class (version, datastore-id, discriminator etc).getSequenceName
(SequenceMetaData seqmd) Method to return the name of sequence.Method to return the name of the table for the specified class.Method to return the name of the (join) table for the specified field.setMaximumLength
(SchemaComponent cmpt, int max) Method to set the maximum length of the name of the specified schema component.setNamingCase
(NamingCase nameCase) Method to set the required case of the names.setQuoteString
(String quote) Method to set the quote string to use (when the identifiers need to be quoted).setReservedKeywords
(Set<String> keywords) Method to set the provided list of keywords as names that identifiers have to surround by quotes to use.setWordSeparator
(String sep) Method to set the word separator of the names.
-
Method Details
-
setReservedKeywords
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
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
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
Method to set the word separator of the names.- Parameters:
sep
- Separator- Returns:
- This naming factory
-
setNamingCase
Method to set the required case of the names.- Parameters:
nameCase
- Required case- Returns:
- This naming factory
-
getTableName
Method to return the name of the table for the specified class.- Parameters:
cmd
- Metadata for the class- Returns:
- Name of the table
-
getTableName
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
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
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
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
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
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
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
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
Method to return the name of sequence.- Parameters:
seqmd
- Metadata for the sequence- Returns:
- Name of the sequence
-