|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.openjpa.enhance.CodeGenerator
public class CodeGenerator
Generates Java class code from metadata.
Constructor Summary | |
---|---|
CodeGenerator(ClassMetaData meta)
Constructor. |
|
CodeGenerator(OpenJPAConfiguration conf,
java.lang.Class type)
Constructor. |
Method Summary | |
---|---|
protected void |
closeClassBrace(org.apache.openjpa.lib.util.CodeFormat code)
Append the closing code-level brace to the code; this can be overridden to add code to the bottom of the class. |
void |
generateCode()
Writes the generated code to the proper directory. |
protected java.lang.String |
getClassCode()
Return a code template for the given class, or null to use the standard system-generated Java code. |
java.lang.String |
getCode()
Return the generated code, or null if generateCode() has not
been called. |
java.io.File |
getCodeDirectory()
The directory to write source to. |
org.apache.openjpa.lib.util.CodeFormat |
getCodeFormat()
The code formatter for the generated Java code. |
protected java.lang.String |
getDeclaration(FieldMetaData field)
Return a code template for the declaration of the given field, or null to use the system-generated default Java code. |
protected java.lang.String |
getFieldCode(FieldMetaData field)
Return a code template for the get/set methods of the given field, or null to use the system-generated default Java code. |
java.io.File |
getFile()
Return Java file to write to. |
java.util.Set |
getImportPackages()
Returns the set of packages that needs to be imported for this code. |
protected java.lang.String |
getInitialValue(FieldMetaData field)
Return code for the initial value for the given field, or null to use the default generated by the system. |
ClassMetaData |
getMetaData()
Return metadata for the type being generated. |
java.lang.Class |
getType()
Return the type being generated. |
protected org.apache.openjpa.lib.util.CodeFormat |
newCodeFormat()
Return a copy of the internal code format. |
protected void |
openClassBrace(org.apache.openjpa.lib.util.CodeFormat code)
Append the opening code-level brace to the code; this can be overridden to add code to the top of the class. |
void |
setCodeFormat(org.apache.openjpa.lib.util.CodeFormat format)
Set the code formatter for the generated Java code. |
void |
setDirectory(java.io.File dir)
The directory to write source to. |
void |
writeCode()
Write the generated code to the proper file. |
void |
writeCode(java.io.Writer out)
Write the code to the specified Writer . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CodeGenerator(OpenJPAConfiguration conf, java.lang.Class type)
public CodeGenerator(ClassMetaData meta)
Method Detail |
---|
public java.io.File getCodeDirectory()
public void setDirectory(java.io.File dir)
public org.apache.openjpa.lib.util.CodeFormat getCodeFormat()
public void setCodeFormat(org.apache.openjpa.lib.util.CodeFormat format)
public java.lang.Class getType()
public ClassMetaData getMetaData()
public java.lang.String getCode()
generateCode()
has not
been called.
public void generateCode()
public void writeCode() throws java.io.IOException
java.io.IOException
public void writeCode(java.io.Writer out) throws java.io.IOException
Writer
.
java.io.IOException
public java.util.Set getImportPackages()
protected void openClassBrace(org.apache.openjpa.lib.util.CodeFormat code)
protected void closeClassBrace(org.apache.openjpa.lib.util.CodeFormat code)
public java.io.File getFile()
protected org.apache.openjpa.lib.util.CodeFormat newCodeFormat()
protected java.lang.String getClassCode()
protected java.lang.String getInitialValue(FieldMetaData field)
protected java.lang.String getDeclaration(FieldMetaData field)
protected java.lang.String getFieldCode(FieldMetaData field)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |