- 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetFileHeader(Definition definition, GeneratorStrategy.Mode mode) getGlobalNamesFileHeader(Definition container, Class<? extends Definition> objectType) getGlobalNamesJavaClassExtends(Definition container, Class<? extends Definition> objectType) getGlobalNamesJavaClassImplements(Definition container, Class<? extends Definition> objectType) getGlobalNamesJavaClassName(Definition container, Class<? extends Definition> objectType) getGlobalNamesJavaPackageName(Definition container, Class<? extends Definition> objectType) 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) booleanWhether fields are instance fields (as opposed to static fields)booleanWhether 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 directorybooleanWhether names of unambiguousForeignKeyDefinitionshould be based on the referencedTableDefinition.voidsetInstanceFields(boolean instanceFields) Whether fields are instance fields (as opposed to static fields)voidsetJavaBeansGettersAndSetters(boolean javaBeansGettersAndSetters) Whether getters and setters should be generated JavaBeans style (or jOOQ style).voidsetTargetDirectory(String directory) Initialise the target directoryvoidsetTargetLanguage(Language targetLanguage) Initialise the target languagevoidsetTargetLocale(Locale targetLocale) Initialise the target localevoidsetTargetPackage(String packageName) Initialise the target package namevoidsetUseTableNameForUnambiguousFKs(boolean useTableNameForUnambiguousFKs) Whether names of unambiguousForeignKeyDefinitionshould 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, getGlobalNamesFile, getGlobalNamesFileName, getGlobalNamesFullJavaClassName, 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:GeneratorStrategyWhether fields are instance fields (as opposed to static fields) -
getInstanceFields
public boolean getInstanceFields()Description copied from interface:GeneratorStrategyWhether fields are instance fields (as opposed to static fields) -
setJavaBeansGettersAndSetters
public void setJavaBeansGettersAndSetters(boolean javaBeansGettersAndSetters) Description copied from interface:GeneratorStrategyWhether getters and setters should be generated JavaBeans style (or jOOQ style). -
getJavaBeansGettersAndSetters
public boolean getJavaBeansGettersAndSetters()Description copied from interface:GeneratorStrategyWhether getters and setters should be generated JavaBeans style (or jOOQ style). -
setUseTableNameForUnambiguousFKs
public void setUseTableNameForUnambiguousFKs(boolean useTableNameForUnambiguousFKs) Description copied from interface:GeneratorStrategyWhether names of unambiguousForeignKeyDefinitionshould be based on the referencedTableDefinition.When a child table has only one
ForeignKeyDefinitiontowards a parent table, then that path is "unambiguous." In that case, someGeneratorStrategyimplementations may choose to use the parent table'sTableDefinitionfor 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:GeneratorStrategyWhether names of unambiguousForeignKeyDefinitionshould be based on the referencedTableDefinition.When a child table has only one
ForeignKeyDefinitiontowards a parent table, then that path is "unambiguous." In that case, someGeneratorStrategyimplementations may choose to use the parent table'sTableDefinitionfor 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:GeneratorStrategyThe target directory -
setTargetDirectory
Description copied from interface:GeneratorStrategyInitialise the target directory -
getTargetPackage
- Returns:
- Get the target package for the current configuration
-
setTargetPackage
Description copied from interface:GeneratorStrategyInitialise the target package name -
getTargetLocale
- Returns:
- Get the target locale for the current configuration
-
setTargetLocale
Description copied from interface:GeneratorStrategyInitialise the target locale -
getTargetLanguage
- Returns:
- Get the target language for the current configuration
-
setTargetLanguage
Description copied from interface:GeneratorStrategyInitialise the target language -
getGlobalNamesFileHeader
public String getGlobalNamesFileHeader(Definition container, Class<? extends Definition> objectType) - Returns:
- The Java class file header of the global names class for a
given definition type, e.g.
This file is generated by jOOQ.
-
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:GeneratorStrategyThis is applied to enum literals of a givenEnumDefinition.- Returns:
- The Java identifier representing this enum literal, e.g. [OK]
-
getJavaIdentifier
Description copied from interface:GeneratorStrategyThis is applied to definitions that can result in reference static and instance members. For instance, the reference instance of aTableDefinitionis a java identifier- Returns:
- The Java identifier representing this object, e.g. [my_table]
-
getJavaSetterName
Description copied from interface:GeneratorStrategyThis 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 anAttributeDefinitionand the container aUDTDefinition- Returns:
- The Java setter method name representing this object, e.g. [setMyTable]
-
getJavaGetterName
Description copied from interface:GeneratorStrategyThis 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 anAttributeDefinitionand the container aUDTDefinition- Returns:
- The Java getter method name representing this object, e.g. [getMyTable]
-
getJavaMethodName
Description copied from interface:GeneratorStrategyThis 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]
-
getGlobalNamesJavaClassExtends
public String getGlobalNamesJavaClassExtends(Definition container, Class<? extends Definition> objectType) - Returns:
- The super class name of the global names class for a given
definition type, e.g. [com.example.AbstractPojo]. If this returns
nullor an empty string, then no super class is extended.
-
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
nullor 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
nullor an empty string, then no super class is extended.
-
getGlobalNamesJavaClassImplements
public List<String> getGlobalNamesJavaClassImplements(Definition container, Class<? extends Definition> objectType) - Returns:
- The implemented interface names of the global names class
for a given definition type, e.g. [com.example.Pojo]. If this
returns
nullor an empty list, then no interfaces are implemented.
-
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
nullor 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
nullor an empty list, then no interfaces are implemented.
-
getGlobalNamesJavaClassName
public String getGlobalNamesJavaClassName(Definition container, Class<? extends Definition> objectType) - Returns:
- The Java class name of the global names class for a given definition type, e.g. [TableNames]
-
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]
-
getGlobalNamesJavaPackageName
public String getGlobalNamesJavaPackageName(Definition container, Class<? extends Definition> objectType) - Returns:
- The Java package name of the global names class for a given definition type, e.g. [org.jooq.generated]
-
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:GeneratorStrategyThe "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
-