Interface GeneratorStrategy

All Known Implementing Classes:
AbstractDelegatingGeneratorStrategy, AbstractGeneratorStrategy, DefaultGeneratorStrategy, JPrefixGeneratorStrategy, JVMArgsGeneratorStrategy, KeepNamesGeneratorStrategy, MatcherStrategy, PrefixSuffixGeneratorStrategy

public interface GeneratorStrategy
A strategy for naming various artefacts generated from Definition's
Author:
Lukas Eder
  • Method Details

    • getTargetDirectory

      String getTargetDirectory()
      The target directory
    • setTargetDirectory

      void setTargetDirectory(String directory)
      Initialise the target directory
    • getTargetPackage

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

      void setTargetPackage(String packageName)
      Initialise the target package name
    • getTargetLocale

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

      void setTargetLocale(Locale targetLocale)
      Initialise the target locale
    • getTargetLanguage

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

      void setTargetLanguage(Language targetLanguage)
      Initialise the target language
    • setInstanceFields

      void setInstanceFields(boolean instanceFields)
      Whether fields are instance fields (as opposed to static fields)
    • getInstanceFields

      boolean getInstanceFields()
      Whether fields are instance fields (as opposed to static fields)
    • setJavaBeansGettersAndSetters

      void setJavaBeansGettersAndSetters(boolean javaBeansGettersAndSetters)
      Whether getters and setters should be generated JavaBeans style (or jOOQ style).
    • getJavaBeansGettersAndSetters

      boolean getJavaBeansGettersAndSetters()
      Whether getters and setters should be generated JavaBeans style (or jOOQ style).
    • setUseTableNameForUnambiguousFKs

      void setUseTableNameForUnambiguousFKs(boolean useTableNameForUnambiguousFKs)
      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 getJavaMethodName(Definition), instead of the ForeignKeyDefinition, e.g. for implicit join paths.

      This flag allows for turning off this default behaviour.

    • getUseTableNameForUnambiguousFKs

      boolean getUseTableNameForUnambiguousFKs()
      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 getJavaMethodName(Definition), instead of the ForeignKeyDefinition, e.g. for implicit join paths.

      This flag allows for turning off this default behaviour.

    • getJavaEnumLiteral

      String getJavaEnumLiteral(EnumDefinition definition, String literal)
      This is applied to enum literals of a given EnumDefinition.
      Returns:
      The Java identifier representing this enum literal, e.g. [OK]
    • getJavaEnumLiterals

      List<String> getJavaEnumLiterals(EnumDefinition definition, Collection<? extends String> literals)
      See Also:
    • getJavaEnumLiterals

      List<String> getJavaEnumLiterals(EnumDefinition definition, String... literals)
      See Also:
    • getJavaIdentifier

      String getJavaIdentifier(Definition definition)
      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]
    • getJavaIdentifiers

      List<String> getJavaIdentifiers(Collection<? extends Definition> definitions)
      See Also:
    • getJavaIdentifiers

      List<String> getJavaIdentifiers(Definition... definitions)
      See Also:
    • getFullJavaIdentifier

      String getFullJavaIdentifier(Definition definition)
      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]
    • getFullJavaIdentifiers

      List<String> getFullJavaIdentifiers(Collection<? extends Definition> definitions)
      See Also:
    • getFullJavaIdentifiers

      List<String> getFullJavaIdentifiers(Definition... definitions)
      See Also:
    • getJavaSetterName

      String getJavaSetterName(Definition definition)
      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

      This is the same as calling getJavaSetterName(definition, Mode.DEFAULT)

      Returns:
      The Java setter method name representing this object, e.g. [setMyTable]
    • getJavaSetterName

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

      String getJavaGetterName(Definition definition)
      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

      This is the same as calling getJavaGetterName(definition, Mode.DEFAULT)

      Returns:
      The Java getter method name representing this object, e.g. [getMyTable]
    • getJavaGetterName

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

      String getJavaMethodName(Definition definition)
      This is applied to definitions that can result in methods. For example, the definition could be a RoutineDefinition

      This is the same as calling getJavaMethodName(definition, Mode.DEFAULT)

      Returns:
      The Java method name representing this object, e.g. [myFunction]
    • getJavaMethodName

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

      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

      String getJavaClassExtends(Definition definition)
      This is the same as calling getJavaClassExtends(definition, Mode.DEFAULT)
      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.
    • getJavaClassExtends

      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

      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

      List<String> getJavaClassImplements(Definition definition)
      This is the same as calling getJavaClassImplements(definition, Mode.DEFAULT)
      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.
    • getJavaClassImplements

      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

      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

      String getJavaClassName(Definition definition)
      This is the same as calling getJavaClassName(definition, Mode.DEFAULT)
      Returns:
      The Java class name representing this object, e.g. [MyTable]
    • getJavaClassName

      String getJavaClassName(Definition definition, GeneratorStrategy.Mode mode)
      Returns:
      The Java class name representing this object, e.g. [MyTableSuffix]
    • getGlobalReferencesJavaPackageName

      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

      String getJavaPackageName(Definition definition)
      This is the same as calling getJavaPackageName(definition, Mode.DEFAULT)
      Returns:
      The Java package name of this object, e.g. [org.jooq.generated]
    • getJavaPackageName

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

      String getJavaMemberName(Definition definition)
      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 This is the same as calling getJavaMemberName(definition, Mode.DEFAULT)
      Returns:
      The Java class name representing this object, starting with a lower case character, e.g. [myTable]
    • getJavaMemberName

      String 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). Example definitions are
      Returns:
      The Java class name representing this object, starting with a lower case character, e.g. [myTableSuffix]
    • getGlobalReferencesFullJavaClassName

      String getGlobalReferencesFullJavaClassName(Definition container, Class<? extends Definition> objectType)
      Returns:
      The full Java class name of the global references class for a given definition type, e.g. [org.jooq.generated.MyTable]
    • getFullJavaClassName

      String getFullJavaClassName(Definition definition)
      Returns:
      The full Java class name representing this object, e.g. [org.jooq.generated.MyTable]
    • getFullJavaClassName

      String getFullJavaClassName(Definition definition, GeneratorStrategy.Mode mode)
      This is the same as calling getFullJavaClassName(definition, Mode.DEFAULT)
      Returns:
      The full Java class name representing this object, e.g. [org.jooq.generated.MyTable][suffix]
    • getGlobalReferencesFileName

      String getGlobalReferencesFileName(Definition container, Class<? extends Definition> objectType)
      Returns:
      The Java class file name of the global references class for a given definition type, e.g. [MyTable.java]
    • getFileName

      String getFileName(Definition definition)
      Returns:
      The Java class file name representing this object, e.g. [MyTable.java]
    • getFileName

      String getFileName(Definition definition, GeneratorStrategy.Mode mode)
      Returns:
      The Java class file name representing this object, e.g. [MyTableSuffix.java]
    • getFileRoot

      File getFileRoot()
      Returns:
      The directory containing all Java objects, e.g. [C:\org\jooq\generated]
    • getGlobalReferencesFile

      File getGlobalReferencesFile(Definition container, Class<? extends Definition> objectType)
      Returns:
      The Java class file name of the global references class for a given definition type, e.g. [C:\org\jooq\generated\MyTable.java]
    • getFile

      File getFile(Definition definition)
      Returns:
      The Java class file name representing this object, e.g. [C:\org\jooq\generated\MyTable.java]
    • getFile

      File getFile(Definition definition, GeneratorStrategy.Mode mode)
      Returns:
      The Java class file name representing this object, e.g. [C:\org\jooq\generated\MyTableSuffix.java]
    • getFile

      File getFile(String fileName)
      Returns:
      The Java class file name representing this object, e.g. [C:\org\jooq\generated\fileName]
    • getGlobalReferencesFileHeader

      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

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

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

      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