- java.lang.Object
-
- org.jooq.codegen.GenerationTool
-
public class GenerationTool extends Object
The GenerationTool takes care of generating Java code from a database schema.It takes its configuration parameters from an XML file passed in either as a JAXB-annotated
Configurationobject, or from the file system when passed as an argument tomain(String[]).See http://www.jooq.org/xsd/ for the latest XSD specification.
- Author:
- Lukas Eder
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_TARGET_DIRECTORYstatic StringDEFAULT_TARGET_ENCODINGstatic StringDEFAULT_TARGET_PACKAGENAME
-
Constructor Summary
Constructors Constructor Description GenerationTool()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static longcopyLarge(InputStream input, OutputStream output)Copy bytes from a large (over 2GB)InputStreamto anOutputStream.static voidgenerate(String xml)static voidgenerate(Configuration configuration)static Configurationload(InputStream in)Load a jOOQ codegen configuration file from an input streamstatic voidmain(String[] args)static voidmain(Configuration configuration)Deprecated.- Usegenerate(Configuration)insteadvoidrun(Configuration configuration)voidsetClassLoader(ClassLoader loader)The class loader to use with this generation tool.voidsetConnection(Connection connection)The JDBC connection to use with this generation tool.voidsetDataSource(DataSource dataSource)The JDBC data source to use with this generation tool.
-
-
-
Field Detail
-
DEFAULT_TARGET_ENCODING
public static final String DEFAULT_TARGET_ENCODING
- See Also:
- Constant Field Values
-
DEFAULT_TARGET_DIRECTORY
public static final String DEFAULT_TARGET_DIRECTORY
- See Also:
- Constant Field Values
-
DEFAULT_TARGET_PACKAGENAME
public static final String DEFAULT_TARGET_PACKAGENAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
setClassLoader
public void setClassLoader(ClassLoader loader)
The class loader to use with this generation tool.If set, all classes are loaded with this class loader
-
setConnection
public void setConnection(Connection connection)
The JDBC connection to use with this generation tool.If set, the configuration XML's
<jdbc/>configuration is ignored, and this connection is used for meta data inspection, instead.
-
setDataSource
public void setDataSource(DataSource dataSource)
The JDBC data source to use with this generation tool.If set, the configuration XML's
<jdbc/>configuration is ignored, and this connection is used for meta data inspection, instead.
-
main
@Deprecated public static void main(Configuration configuration) throws Exception
Deprecated.- Usegenerate(Configuration)instead- Throws:
Exception
-
generate
public static void generate(Configuration configuration) throws Exception
- Throws:
Exception
-
run
public void run(Configuration configuration) throws Exception
- Throws:
Exception
-
copyLarge
public static long copyLarge(InputStream input, OutputStream output) throws IOException
Copy bytes from a large (over 2GB)InputStreamto anOutputStream.This method buffers the input internally, so there is no need to use a
BufferedInputStream.- Parameters:
input- theInputStreamto read fromoutput- theOutputStreamto write to- Returns:
- the number of bytes copied
- Throws:
NullPointerException- if the input or output is nullIOException- if an I/O error occurs- Since:
- Commons IO 1.3
-
load
public static Configuration load(InputStream in) throws IOException
Load a jOOQ codegen configuration file from an input stream- Throws:
IOException
-
-