|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.cloudera.sqoop.orm.ClassWriter
public class ClassWriter
Creates an ORM class to represent a table from a database.
Field Summary | |
---|---|
static int |
CLASS_WRITER_VERSION
This version number is injected into all generated Java classes to denote which version of the ClassWriter's output format was used to generate the class. |
static java.util.HashSet<java.lang.String> |
JAVA_RESERVED_WORDS
|
static org.apache.commons.logging.Log |
LOG
|
Constructor Summary | |
---|---|
ClassWriter(SqoopOptions opts,
ConnManager connMgr,
java.lang.String table,
CompilationManager compMgr)
Creates a new ClassWriter to generate an ORM class for a table. |
Method Summary | |
---|---|
void |
generate()
Generate the ORM code for the class. |
java.lang.StringBuilder |
generateClassForColumns(java.util.Map<java.lang.String,java.lang.Integer> columnTypes,
java.lang.String[] colNames)
Generate the ORM code for a table object containing the named columns. |
static java.lang.String |
toIdentifier(java.lang.String candidate)
Coerce a candidate name for an identifier into one which will definitely compile. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.apache.commons.logging.Log LOG
public static final java.util.HashSet<java.lang.String> JAVA_RESERVED_WORDS
public static final int CLASS_WRITER_VERSION
Constructor Detail |
---|
public ClassWriter(SqoopOptions opts, ConnManager connMgr, java.lang.String table, CompilationManager compMgr)
opts
- program-wide optionsconnMgr
- the connection manager used to describe the table.table
- the name of the table to read.Method Detail |
---|
public static java.lang.String toIdentifier(java.lang.String candidate)
candidate
- A string we want to use as an identifier
public void generate() throws java.io.IOException
java.io.IOException
public java.lang.StringBuilder generateClassForColumns(java.util.Map<java.lang.String,java.lang.Integer> columnTypes, java.lang.String[] colNames)
columnTypes
- - mapping from column names to sql typescolNames
- - ordered list of column names for table.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |