|
Dali Provisional API Release 3.2 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.io.Writer
java.io.PrintWriter
org.eclipse.jpt.common.utility.io.IndentingPrintWriter
org.eclipse.jpt.common.core.utility.BodySourceWriter
public class BodySourceWriter
Extend IndentingPrintWriter with some methods that facilitate
building class source code.
| Nested Class Summary | |
|---|---|
protected static class |
BodySourceWriter.ImportEntriesComparator
|
protected static class |
BodySourceWriter.ImportEntriesTransformer
|
protected static class |
BodySourceWriter.ImportPackage
We need a 'collision' flag for when we encounter a class from 'java.lang' followed by a class from the current compilation unit's package. |
protected class |
BodySourceWriter.RequiredImportEntriesFilter
|
| Field Summary | |
|---|---|
protected String |
className
|
protected static Comparator<Map.Entry<String,BodySourceWriter.ImportPackage>> |
IMPORT_ENTRIES_COMPARATOR
|
protected static org.eclipse.jpt.common.utility.transformer.Transformer<Map.Entry<String,BodySourceWriter.ImportPackage>,String> |
IMPORT_ENTRIES_TRANSFORMER
|
protected HashMap<String,BodySourceWriter.ImportPackage> |
imports
|
protected String |
packageName
|
| Fields inherited from class org.eclipse.jpt.common.utility.io.IndentingPrintWriter |
|---|
DEFAULT_INDENT |
| Fields inherited from class java.io.PrintWriter |
|---|
out |
| Fields inherited from class java.io.Writer |
|---|
lock |
| Constructor Summary | |
|---|---|
BodySourceWriter(String packageName,
String className,
String lineSeparator)
|
|
| Method Summary | |
|---|---|
protected String |
buildImportedTypeDeclaration(String typeDeclaration)
Return the specified class's "imported" name. |
protected Comparator<Map.Entry<String,BodySourceWriter.ImportPackage>> |
buildImportEntriesComparator()
|
protected org.eclipse.jpt.common.utility.transformer.Transformer<Map.Entry<String,BodySourceWriter.ImportPackage>,String> |
buildImportEntriesTransformer()
|
protected String |
buildMemberClassTypeDeclaration(String typeDeclaration)
e.g. |
protected org.eclipse.jpt.common.utility.predicate.Predicate<Map.Entry<String,BodySourceWriter.ImportPackage>> |
buildRequiredImportEntriesFilter()
|
Iterable<String> |
getImports()
|
int |
getLength()
|
protected Iterable<Map.Entry<String,BodySourceWriter.ImportPackage>> |
getRequiredImportEntries()
strip off any non-required imports (e.g. |
protected Iterable<Map.Entry<String,BodySourceWriter.ImportPackage>> |
getSortedRequiredImportEntries()
sort by package first, then class (*not* by fully-qualified class name) |
protected Iterable<String> |
getSortedRequiredImports()
transform our map entries to class names |
String |
getSource()
|
void |
printAnnotation(String annotationName)
|
protected void |
printField(String fieldName,
String typeDeclaration,
String visibility)
|
protected void |
printParameterizedField(String fieldName,
String typeDeclaration,
String parameterTypeDeclaration,
String visibility)
|
void |
printStringLiteral(String string)
Convert the specified string to a String Literal and print it, adding the surrounding double-quotes and escaping characters as necessary. |
void |
printTypeDeclaration(String typeDeclaration)
|
protected void |
printVisibility(String visibilityModifier)
|
protected boolean |
typeDeclarationIsMemberClass(String typeDeclaration)
e.g. |
| Methods inherited from class org.eclipse.jpt.common.utility.io.IndentingPrintWriter |
|---|
decrementIndentLevel, getIndentLevel, incrementIndentLevel, indent, println, setIndentLevel, undent, write, write, write |
| Methods inherited from class java.io.PrintWriter |
|---|
append, append, append, checkError, clearError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, setError, write, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final String packageName
protected final String className
protected final HashMap<String,BodySourceWriter.ImportPackage> imports
protected static final org.eclipse.jpt.common.utility.transformer.Transformer<Map.Entry<String,BodySourceWriter.ImportPackage>,String> IMPORT_ENTRIES_TRANSFORMER
protected static final Comparator<Map.Entry<String,BodySourceWriter.ImportPackage>> IMPORT_ENTRIES_COMPARATOR
| Constructor Detail |
|---|
public BodySourceWriter(String packageName,
String className,
String lineSeparator)
| Method Detail |
|---|
public String getSource()
public int getLength()
protected void printVisibility(String visibilityModifier)
public void printAnnotation(String annotationName)
public void printTypeDeclaration(String typeDeclaration)
protected void printField(String fieldName,
String typeDeclaration,
String visibility)
protected void printParameterizedField(String fieldName,
String typeDeclaration,
String parameterTypeDeclaration,
String visibility)
public void printStringLiteral(String string)
protected String buildImportedTypeDeclaration(String typeDeclaration)
protected boolean typeDeclarationIsMemberClass(String typeDeclaration)
protected String buildMemberClassTypeDeclaration(String typeDeclaration)
public Iterable<String> getImports()
protected Iterable<String> getSortedRequiredImports()
protected org.eclipse.jpt.common.utility.transformer.Transformer<Map.Entry<String,BodySourceWriter.ImportPackage>,String> buildImportEntriesTransformer()
protected Iterable<Map.Entry<String,BodySourceWriter.ImportPackage>> getSortedRequiredImportEntries()
protected Comparator<Map.Entry<String,BodySourceWriter.ImportPackage>> buildImportEntriesComparator()
protected Iterable<Map.Entry<String,BodySourceWriter.ImportPackage>> getRequiredImportEntries()
protected org.eclipse.jpt.common.utility.predicate.Predicate<Map.Entry<String,BodySourceWriter.ImportPackage>> buildRequiredImportEntriesFilter()
|
Dali Provisional API Release 3.2 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||