- All Implemented Interfaces:
GeneratorStrategy
- Direct Known Subclasses:
JPrefixGeneratorStrategy
,JVMArgsGeneratorStrategy
,KeepNamesGeneratorStrategy
,MatcherStrategy
JavaGenerator
- Author:
- Lukas Eder
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jooq.codegen.GeneratorStrategy
GeneratorStrategy.Mode
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetFileHeader
(Definition definition, GeneratorStrategy.Mode mode) getGlobalReferencesFileHeader
(Definition container, Class<? extends Definition> objectType) getGlobalReferencesJavaClassExtends
(Definition container, Class<? extends Definition> objectType) getGlobalReferencesJavaClassImplements
(Definition container, Class<? extends Definition> objectType) getGlobalReferencesJavaClassName
(Definition container, Class<? extends Definition> objectType) getGlobalReferencesJavaPackageName
(Definition container, Class<? extends Definition> objectType) boolean
Whether fields are instance fields (as opposed to static fields)boolean
Whether getters and setters should be generated JavaBeans style (or jOOQ style).getJavaClassExtends
(Definition definition, GeneratorStrategy.Mode mode) getJavaClassImplements
(Definition definition, GeneratorStrategy.Mode mode) getJavaClassName
(Definition definition, GeneratorStrategy.Mode mode) getJavaEnumLiteral
(EnumDefinition definition, String literal) This is applied to enum literals of a givenEnumDefinition
.getJavaGetterName
(Definition definition, GeneratorStrategy.Mode mode) This is applied to definitions that can result in getters of a container.getJavaIdentifier
(Definition definition) This is applied to definitions that can result in reference static and instance members.getJavaMemberName
(Definition definition, GeneratorStrategy.Mode mode) The "java member name" is applied where a definition is used as a member (for POJOs) or as a method argument (for setters).getJavaMethodName
(Definition definition, GeneratorStrategy.Mode mode) This is applied to definitions that can result in methods.getJavaPackageName
(Definition definition, GeneratorStrategy.Mode mode) getJavaSetterName
(Definition definition, GeneratorStrategy.Mode mode) This is applied to definitions that can result in setters of a container.getOverloadSuffix
(Definition definition, GeneratorStrategy.Mode mode, String overloadIndex) The target directoryboolean
Whether names of unambiguousForeignKeyDefinition
should be based on the referencedTableDefinition
.void
setInstanceFields
(boolean instanceFields) Whether fields are instance fields (as opposed to static fields)void
setJavaBeansGettersAndSetters
(boolean javaBeansGettersAndSetters) Whether getters and setters should be generated JavaBeans style (or jOOQ style).void
setTargetDirectory
(String directory) Initialise the target directoryvoid
setTargetLanguage
(Language targetLanguage) Initialise the target languagevoid
setTargetLocale
(Locale targetLocale) Initialise the target localevoid
setTargetPackage
(String packageName) Initialise the target package namevoid
setUseTableNameForUnambiguousFKs
(boolean useTableNameForUnambiguousFKs) Whether names of unambiguousForeignKeyDefinition
should be based on the referencedTableDefinition
.Methods inherited from class org.jooq.codegen.AbstractGeneratorStrategy
getFile, getFile, getFile, getFileHeader, getFileName, getFileName, getFileRoot, getFullJavaClassName, getFullJavaClassName, getFullJavaIdentifier, getFullJavaIdentifiers, getFullJavaIdentifiers, getGlobalReferencesFile, getGlobalReferencesFileName, getGlobalReferencesFullJavaClassName, getJavaClassExtends, getJavaClassImplements, getJavaClassName, getJavaEnumLiterals, getJavaEnumLiterals, getJavaGetterName, getJavaIdentifiers, getJavaIdentifiers, getJavaMemberName, getJavaMethodName, getJavaPackageName, getJavaSetterName
-
Constructor Details
-
DefaultGeneratorStrategy
public DefaultGeneratorStrategy()
-
-
Method Details
-
setInstanceFields
public void setInstanceFields(boolean instanceFields) Description copied from interface:GeneratorStrategy
Whether fields are instance fields (as opposed to static fields) -
getInstanceFields
public boolean getInstanceFields()Description copied from interface:GeneratorStrategy
Whether fields are instance fields (as opposed to static fields) -
setJavaBeansGettersAndSetters
public void setJavaBeansGettersAndSetters(boolean javaBeansGettersAndSetters) Description copied from interface:GeneratorStrategy
Whether getters and setters should be generated JavaBeans style (or jOOQ style). -
getJavaBeansGettersAndSetters
public boolean getJavaBeansGettersAndSetters()Description copied from interface:GeneratorStrategy
Whether getters and setters should be generated JavaBeans style (or jOOQ style). -
setUseTableNameForUnambiguousFKs
public void setUseTableNameForUnambiguousFKs(boolean useTableNameForUnambiguousFKs) Description copied from interface:GeneratorStrategy
Whether names of unambiguousForeignKeyDefinition
should be based on the referencedTableDefinition
.When a child table has only one
ForeignKeyDefinition
towards a parent table, then that path is "unambiguous." In that case, someGeneratorStrategy
implementations may choose to use the parent table'sTableDefinition
for implementations ofGeneratorStrategy.getJavaMethodName(Definition)
, instead of theForeignKeyDefinition
, e.g. for implicit join paths.This flag allows for turning off this default behaviour.
-
getUseTableNameForUnambiguousFKs
public boolean getUseTableNameForUnambiguousFKs()Description copied from interface:GeneratorStrategy
Whether names of unambiguousForeignKeyDefinition
should be based on the referencedTableDefinition
.When a child table has only one
ForeignKeyDefinition
towards a parent table, then that path is "unambiguous." In that case, someGeneratorStrategy
implementations may choose to use the parent table'sTableDefinition
for implementations ofGeneratorStrategy.getJavaMethodName(Definition)
, instead of theForeignKeyDefinition
, e.g. for implicit join paths.This flag allows for turning off this default behaviour.
-
getTargetDirectory
Description copied from interface:GeneratorStrategy
The target directory -
setTargetDirectory
Description copied from interface:GeneratorStrategy
Initialise the target directory -
getTargetPackage
- Returns:
- Get the target package for the current configuration
-
setTargetPackage
Description copied from interface:GeneratorStrategy
Initialise the target package name -
getTargetLocale
- Returns:
- Get the target locale for the current configuration
-
setTargetLocale
Description copied from interface:GeneratorStrategy
Initialise the target locale -
getTargetLanguage
- Returns:
- Get the target language for the current configuration
-
setTargetLanguage
Description copied from interface:GeneratorStrategy
Initialise the target language -
getGlobalReferencesFileHeader
public String getGlobalReferencesFileHeader(Definition container, Class<? extends Definition> objectType) - Returns:
- The Java class file header of the global references class for a
given definition type, e.g.
This file is generated by jOOQ.
-
getFileHeader
- Returns:
- The Java class file header, e.g.
This file is generated by jOOQ.
-
getJavaEnumLiteral
Description copied from interface:GeneratorStrategy
This is applied to enum literals of a givenEnumDefinition
.- Returns:
- The Java identifier representing this enum literal, e.g. [OK]
-
getJavaIdentifier
Description copied from interface:GeneratorStrategy
This is applied to definitions that can result in reference static and instance members. For instance, the reference instance of aTableDefinition
is a java identifier- Returns:
- The Java identifier representing this object, e.g. [my_table]
-
getJavaSetterName
Description copied from interface:GeneratorStrategy
This is applied to definitions that can result in setters of a container. For example, the definition could be aColumnDefinition
, the container aTableDefinition
. Then this would apply to records and POJOs. Also, the definition could be anAttributeDefinition
and the container aUDTDefinition
- Returns:
- The Java setter method name representing this object, e.g. [setMyTable]
-
getJavaGetterName
Description copied from interface:GeneratorStrategy
This is applied to definitions that can result in getters of a container. For example, the definition could be aColumnDefinition
, the container aTableDefinition
. Then this would apply to records and POJOs. Also, the definition could be anAttributeDefinition
and the container aUDTDefinition
- Returns:
- The Java getter method name representing this object, e.g. [getMyTable]
-
getJavaMethodName
Description copied from interface:GeneratorStrategy
This is applied to definitions that can result in methods. For example, the definition could be aRoutineDefinition
- Returns:
- The Java method name representing this object, e.g. [myFunction]
-
getGlobalReferencesJavaClassExtends
public String getGlobalReferencesJavaClassExtends(Definition container, Class<? extends Definition> objectType) - Returns:
- The super class name of the global references class for a given
definition type, e.g. [com.example.AbstractPojo]. If this returns
null
or an empty string, then no super class is extended.
-
getJavaClassExtends
- Returns:
- The super class name of the Java class representing this object,
e.g. [com.example.AbstractPojo]. If this returns
null
or an empty string, then no super class is extended.
-
getGlobalReferencesJavaClassImplements
public List<String> getGlobalReferencesJavaClassImplements(Definition container, Class<? extends Definition> objectType) - Returns:
- The implemented interface names of the global references class
for a given definition type, e.g. [com.example.Pojo]. If this
returns
null
or an empty list, then no interfaces are implemented.
-
getJavaClassImplements
- Returns:
- The implemented interface names of the Java class name
representing this object, e.g. [com.example.Pojo]. If this
returns
null
or an empty list, then no interfaces are implemented.
-
getGlobalReferencesJavaClassName
public String getGlobalReferencesJavaClassName(Definition container, Class<? extends Definition> objectType) - Returns:
- The Java class name of the global references class for a given definition type, e.g. [MyTableSuffix]
-
getJavaClassName
- Returns:
- The Java class name representing this object, e.g. [MyTableSuffix]
-
getGlobalReferencesJavaPackageName
public String getGlobalReferencesJavaPackageName(Definition container, Class<? extends Definition> objectType) - Returns:
- The Java package name of the global references class for a given definition type, e.g. [org.jooq.generated]
-
getJavaPackageName
- Returns:
- The Java package name of this object, e.g. [org.jooq.generated]
-
getJavaMemberName
Description copied from interface:GeneratorStrategy
The "java member name" is applied where a definition is used as a member (for POJOs) or as a method argument (for setters). Example definitions are- Returns:
- The Java class name representing this object, starting with a lower case character, e.g. [myTableSuffix]
-
getOverloadSuffix
public String getOverloadSuffix(Definition definition, GeneratorStrategy.Mode mode, String overloadIndex) - Returns:
- The overload suffix to be applied when generating overloaded
routine artefacts, e.g.
"_OverloadIndex_" + overloadIndex
-