public class SourceCode extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SourceCode.ACCESS |
class |
SourceCode.Annotation
Represents annotation.
|
class |
SourceCode.Argument<K,V>
Represents method argument.
|
class |
SourceCode.Class
Represent
class declaration. |
(package private) class |
SourceCode.Comment |
class |
SourceCode.Constructor |
(package private) static class |
SourceCode.Delimiter |
class |
SourceCode.Element<T>
Abstract element has a name, optional list of modifiers, annotations
and arguments.
|
class |
SourceCode.Field
Represents field declaration.
|
(package private) class |
SourceCode.Import
Represents
import statement. |
class |
SourceCode.Method
Represents Method declaration.
|
(package private) static class |
SourceCode.Package |
Modifier and Type | Field and Description |
---|---|
static String |
COMMA |
static String |
DOT |
static String |
EQUAL |
static String |
QUOTE |
Constructor and Description |
---|
SourceCode(String c)
Create source code for a top-level class with given fully-qualified
class name.
|
Modifier and Type | Method and Description |
---|---|
SourceCode |
addComment(boolean inline,
String... lines) |
(package private) static String |
capitalize(String s) |
org.apache.openjpa.persistence.util.SourceCode.ClassName |
getOrCreateImport(String name)
Get the class name instance for the given fully-qualified class name.
|
SourceCode.Package |
getPackage() |
SourceCode.Class |
getTopLevelClass()
Gets the top level class represented by this receiver.
|
(package private) static boolean |
isEmpty(String s) |
static boolean |
isJavaIdentifier(String s) |
static boolean |
isKnownType(String s) |
(package private) static boolean |
isValidToken(String s) |
SourceCode |
setTabSize(int t)
Sets the tab size.
|
(package private) static void |
tab(PrintWriter out,
int tab)
Outputs
tab number of spaces. |
(package private) static LinkedList<String> |
tokenize(String s,
String delim) |
static String[] |
wrap(String longLine,
int width)
Wraps the given string into lines of max length width at word boundaries
|
void |
write(PrintWriter out)
Prints the class to the given Writer.
|
(package private) static void |
writeList(PrintWriter out,
String header,
List<?> list) |
(package private) static void |
writeList(PrintWriter out,
String header,
List<?> list,
SourceCode.Delimiter bracket,
boolean writeEmpty) |
public static final String COMMA
public static final String DOT
public static final String EQUAL
public static final String QUOTE
public SourceCode(String c)
public SourceCode.Class getTopLevelClass()
public SourceCode.Package getPackage()
public SourceCode setTabSize(int t)
public org.apache.openjpa.persistence.util.SourceCode.ClassName getOrCreateImport(String name)
name
- fully-qualified name of a classaddImport(ClassName)
,
ClassName
public SourceCode addComment(boolean inline, String... lines)
public void write(PrintWriter out)
out
- static void tab(PrintWriter out, int tab)
tab
number of spaces.public static String[] wrap(String longLine, int width)
static void writeList(PrintWriter out, String header, List<?> list)
static void writeList(PrintWriter out, String header, List<?> list, SourceCode.Delimiter bracket, boolean writeEmpty)
static boolean isValidToken(String s)
public static boolean isKnownType(String s)
static boolean isEmpty(String s)
static LinkedList<String> tokenize(String s, String delim)
public static boolean isJavaIdentifier(String s)
Copyright © 2006–2015 Apache Software Foundation. All rights reserved.