Class SourceCode
java.lang.Object
org.apache.openjpa.persistence.util.SourceCode
A utility to help writing Java Source code dynamically.
 Provides basic elements of Java Source Code e.g. Package, Class, Field,
 Method, Import, Annotation, Argument.
 Mutator methods return the operating element for easy chaining.
- Since:
- 2.0.0
- Author:
- Pinaki Poddar
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumclassRepresents annotation.classRepresents method argument.classRepresentclassdeclaration.classclassAbstract element has a name, optional list of modifiers, annotations and arguments.classRepresents field declaration.classRepresents Method declaration.
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionSourceCode(String c) Create source code for a top-level class with given fully-qualified class name.
- 
Method SummaryModifier and TypeMethodDescriptionaddComment(boolean inline, String... lines) org.apache.openjpa.persistence.util.SourceCode.ClassNamegetOrCreateImport(String name) Get the class name instance for the given fully-qualified class name.org.apache.openjpa.persistence.util.SourceCode.PackageGets the top level class represented by this receiver.static booleanstatic booleansetTabSize(int t) Sets the tab size.static String[]Wraps the given string into lines of max length width at word boundariesvoidwrite(PrintWriter out) Prints the class to the given Writer.
- 
Field Details- 
COMMA- See Also:
 
- 
DOT- See Also:
 
- 
EQUAL- See Also:
 
- 
QUOTE- See Also:
 
 
- 
- 
Constructor Details- 
SourceCodeCreate source code for a top-level class with given fully-qualified class name.
 
- 
- 
Method Details- 
getTopLevelClassGets the top level class represented by this receiver.
- 
getPackagepublic org.apache.openjpa.persistence.util.SourceCode.Package getPackage()
- 
setTabSizeSets the tab size. Tabs are always written as spaces.
- 
getOrCreateImportGet the class name instance for the given fully-qualified class name. If the given class name is already imported, then use the existing instance. Otherwise, creates a new instance and adds it to list of imports.- Parameters:
- name- fully-qualified name of a class
- Returns:
- an existing class name instance or a new one.
- See Also:
- 
- addImport(ClassName)
- SourceCode.ClassName
 
 
- 
addComment
- 
writePrints the class to the given Writer.- Parameters:
- out-
 
- 
wrapWraps the given string into lines of max length width at word boundaries
- 
isKnownType
- 
isJavaIdentifier
 
-