Class Context


public class Context extends PropertyHolder
  • Constructor Details

    • Context

      public Context(ModelType defaultModelType)
  • Method Details

    • addTableConfiguration

      public void addTableConfiguration(TableConfiguration tc)
    • getJavaClientGeneratorConfiguration

      public JavaClientGeneratorConfiguration getJavaClientGeneratorConfiguration()
    • getJavaModelGeneratorConfiguration

      public JavaModelGeneratorConfiguration getJavaModelGeneratorConfiguration()
    • getJavaTypeResolverConfiguration

      public JavaTypeResolverConfiguration getJavaTypeResolverConfiguration()
    • getSqlMapGeneratorConfiguration

      public SqlMapGeneratorConfiguration getSqlMapGeneratorConfiguration()
    • addPluginConfiguration

      public void addPluginConfiguration(PluginConfiguration pluginConfiguration)
    • validate

      public void validate(List<String> errors)
      This method does a simple validate, it makes sure that all required fields have been filled in. It does not do any more complex operations such as validating that database tables exist or validating that named columns exist
      Parameters:
      errors - the errors
    • getId

      public String getId()
    • setId

      public void setId(String id)
    • setJavaClientGeneratorConfiguration

      public void setJavaClientGeneratorConfiguration(JavaClientGeneratorConfiguration javaClientGeneratorConfiguration)
    • setJavaModelGeneratorConfiguration

      public void setJavaModelGeneratorConfiguration(JavaModelGeneratorConfiguration javaModelGeneratorConfiguration)
    • setJavaTypeResolverConfiguration

      public void setJavaTypeResolverConfiguration(JavaTypeResolverConfiguration javaTypeResolverConfiguration)
    • setJdbcConnectionConfiguration

      public void setJdbcConnectionConfiguration(JDBCConnectionConfiguration jdbcConnectionConfiguration)
    • setSqlMapGeneratorConfiguration

      public void setSqlMapGeneratorConfiguration(SqlMapGeneratorConfiguration sqlMapGeneratorConfiguration)
    • getDefaultModelType

      public ModelType getDefaultModelType()
    • getBeginningDelimiter

      public String getBeginningDelimiter()
    • getEndingDelimiter

      public String getEndingDelimiter()
    • addProperty

      public void addProperty(String name, String value)
      Overrides:
      addProperty in class PropertyHolder
    • getCommentGenerator

      public CommentGenerator getCommentGenerator()
    • getJavaFormatter

      public JavaFormatter getJavaFormatter()
    • getKotlinFormatter

      public KotlinFormatter getKotlinFormatter()
    • getXmlFormatter

      public XmlFormatter getXmlFormatter()
    • getCommentGeneratorConfiguration

      public CommentGeneratorConfiguration getCommentGeneratorConfiguration()
    • setCommentGeneratorConfiguration

      public void setCommentGeneratorConfiguration(CommentGeneratorConfiguration commentGeneratorConfiguration)
    • getPlugins

      public Plugin getPlugins()
    • getTargetRuntime

      public String getTargetRuntime()
    • setTargetRuntime

      public void setTargetRuntime(String targetRuntime)
    • getIntrospectedColumnImpl

      public String getIntrospectedColumnImpl()
    • setIntrospectedColumnImpl

      public void setIntrospectedColumnImpl(String introspectedColumnImpl)
    • getIntrospectedTables

      public List<IntrospectedTable> getIntrospectedTables()
      This method could be useful for users that use the library for introspection only and not for code generation.
      Returns:
      a list containing the results of table introspection. The list will be empty if this method is called before introspectTables(), or if no tables are found that match the configuration
    • getIntrospectionSteps

      public int getIntrospectionSteps()
    • introspectTables

      public void introspectTables(ProgressCallback callback, List<String> warnings, Set<String> fullyQualifiedTableNames) throws SQLException, InterruptedException
      Introspect tables based on the configuration specified in the constructor. This method is long running.
      Parameters:
      callback - a progress callback if progress information is desired, or null
      warnings - any warning generated from this method will be added to the List. Warnings are always Strings.
      fullyQualifiedTableNames - a set of table names to generate. The elements of the set must be Strings that exactly match what's specified in the configuration. For example, if table name = "foo" and schema = "bar", then the fully qualified table name is "foo.bar". If the Set is null or empty, then all tables in the configuration will be used for code generation.
      Throws:
      SQLException - if some error arises while introspecting the specified database tables.
      InterruptedException - if the progress callback reports a cancel
    • getGenerationSteps

      public int getGenerationSteps()
    • generateFiles

      public void generateFiles(ProgressCallback callback, List<GeneratedJavaFile> generatedJavaFiles, List<GeneratedXmlFile> generatedXmlFiles, List<GeneratedKotlinFile> generatedKotlinFiles, List<GeneratedFile> otherGeneratedFiles, List<String> warnings) throws InterruptedException
      Throws:
      InterruptedException
    • getConnection

      public Connection getConnection() throws SQLException
      This method creates a new JDBC connection from the values specified in the configuration file. If you call this method, then you are responsible for closing the connection (See closeConnection(Connection)). If you do not close the connection, then there could be connection leaks.
      Returns:
      a new connection created from the values in the configuration file
      Throws:
      SQLException - if any error occurs while creating the connection
    • closeConnection

      public void closeConnection(Connection connection)
      This method closes a JDBC connection and ignores any errors. If the passed connection is null, then the method does nothing.
      Parameters:
      connection - a JDBC connection to close, may be null
    • autoDelimitKeywords

      public boolean autoDelimitKeywords()
    • getConnectionFactoryConfiguration

      public ConnectionFactoryConfiguration getConnectionFactoryConfiguration()
    • setConnectionFactoryConfiguration

      public void setConnectionFactoryConfiguration(ConnectionFactoryConfiguration connectionFactoryConfiguration)