Class DefaultGeneratorStrategy

java.lang.Object
org.jooq.codegen.AbstractGeneratorStrategy
org.jooq.codegen.DefaultGeneratorStrategy
All Implemented Interfaces:
GeneratorStrategy
Direct Known Subclasses:
JPrefixGeneratorStrategy, JVMArgsGeneratorStrategy, KeepNamesGeneratorStrategy, MatcherStrategy

public class DefaultGeneratorStrategy extends AbstractGeneratorStrategy
The default naming strategy for the JavaGenerator
Author:
Lukas Eder
  • 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 unambiguous ForeignKeyDefinition should be based on the referenced TableDefinition.

      When a child table has only one ForeignKeyDefinition towards a parent table, then that path is "unambiguous." In that case, some GeneratorStrategy implementations may choose to use the parent table's TableDefinition for implementations of GeneratorStrategy.getJavaMethodName(Definition), instead of the ForeignKeyDefinition, 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 unambiguous ForeignKeyDefinition should be based on the referenced TableDefinition.

      When a child table has only one ForeignKeyDefinition towards a parent table, then that path is "unambiguous." In that case, some GeneratorStrategy implementations may choose to use the parent table's TableDefinition for implementations of GeneratorStrategy.getJavaMethodName(Definition), instead of the ForeignKeyDefinition, e.g. for implicit join paths.

      This flag allows for turning off this default behaviour.

    • getTargetDirectory

      public String getTargetDirectory()
      Description copied from interface: GeneratorStrategy
      The target directory
    • setTargetDirectory

      public void setTargetDirectory(String directory)
      Description copied from interface: GeneratorStrategy
      Initialise the target directory
    • getTargetPackage

      public String getTargetPackage()
      Returns:
      Get the target package for the current configuration
    • setTargetPackage

      public void setTargetPackage(String packageName)
      Description copied from interface: GeneratorStrategy
      Initialise the target package name
    • getTargetLocale

      public Locale getTargetLocale()
      Returns:
      Get the target locale for the current configuration
    • setTargetLocale

      public void setTargetLocale(Locale targetLocale)
      Description copied from interface: GeneratorStrategy
      Initialise the target locale
    • getTargetLanguage

      public Language getTargetLanguage()
      Returns:
      Get the target language for the current configuration
    • setTargetLanguage

      public void setTargetLanguage(Language targetLanguage)
      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

      public String getFileHeader(Definition definition, GeneratorStrategy.Mode mode)
      Returns:
      The Java class file header, e.g.
      
       This file is generated by jOOQ.
       
    • getJavaEnumLiteral

      public String getJavaEnumLiteral(EnumDefinition definition, String literal)
      Description copied from interface: GeneratorStrategy
      This is applied to enum literals of a given EnumDefinition.
      Returns:
      The Java identifier representing this enum literal, e.g. [OK]
    • getJavaIdentifier

      public String getJavaIdentifier(Definition definition)
      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 a TableDefinition is a java identifier
      Returns:
      The Java identifier representing this object, e.g. [my_table]
    • getJavaSetterName

      public String getJavaSetterName(Definition definition, GeneratorStrategy.Mode mode)
      Description copied from interface: GeneratorStrategy
      This is applied to definitions that can result in setters of a container. For example, the definition could be a ColumnDefinition, the container a TableDefinition. Then this would apply to records and POJOs. Also, the definition could be an AttributeDefinition and the container a UDTDefinition
      Returns:
      The Java setter method name representing this object, e.g. [setMyTable]
    • getJavaGetterName

      public String getJavaGetterName(Definition definition, GeneratorStrategy.Mode mode)
      Description copied from interface: GeneratorStrategy
      This is applied to definitions that can result in getters of a container. For example, the definition could be a ColumnDefinition, the container a TableDefinition. Then this would apply to records and POJOs. Also, the definition could be an AttributeDefinition and the container a UDTDefinition
      Returns:
      The Java getter method name representing this object, e.g. [getMyTable]
    • getJavaMethodName

      public String getJavaMethodName(Definition definition, GeneratorStrategy.Mode mode)
      Description copied from interface: GeneratorStrategy
      This is applied to definitions that can result in methods. For example, the definition could be a RoutineDefinition
      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

      public String getJavaClassExtends(Definition definition, GeneratorStrategy.Mode mode)
      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

      public List<String> getJavaClassImplements(Definition definition, GeneratorStrategy.Mode mode)
      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

      public String getJavaClassName(Definition definition, GeneratorStrategy.Mode mode)
      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

      public String getJavaPackageName(Definition definition, GeneratorStrategy.Mode mode)
      Returns:
      The Java package name of this object, e.g. [org.jooq.generated]
    • getJavaMemberName

      public String getJavaMemberName(Definition definition, GeneratorStrategy.Mode mode)
      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