class ImplJSourceFile extends BasicJCommentable implements JSourceFile
Modifier and Type | Field and Description |
---|---|
private java.util.ArrayList<ClassFileContent> |
content |
private java.lang.String |
fileName |
private java.util.Map<java.lang.String,AbstractJType> |
imports |
private java.lang.String |
packageName |
private boolean |
packageWritten |
private ImplJSources |
sources |
private java.util.Map<java.lang.String,StaticRefJExpr> |
staticImports |
Constructor and Description |
---|
ImplJSourceFile(ImplJSources sources,
java.lang.String packageName,
java.lang.String fileName) |
Modifier and Type | Method and Description |
---|---|
JClassDef |
_class(int mods,
java.lang.String name)
Add a class definition to this source file.
|
JClassDef |
_enum(int mods,
java.lang.String name)
Add an enum definition to this source file.
|
JSourceFile |
_import(java.lang.Class<?> type)
Add a type import to this source file.
|
JSourceFile |
_import(JType type)
Add a type import to this source file.
|
JSourceFile |
_import(java.lang.String type)
Add a type import to this source file.
|
JClassDef |
_interface(int mods,
java.lang.String name)
Add an interface definition to this source file.
|
private <C extends ClassFileContent> |
add(C item) |
JClassDef |
annotationInterface(int mods,
java.lang.String name)
Add an annotation interface definition to this source file.
|
JSourceFile |
blankLine()
Add a blank line to this source file.
|
private void |
checkPackage() |
(package private) java.lang.String |
getFileName() |
(package private) java.lang.String |
getPackageName() |
(package private) ImplJSources |
getSources() |
(package private) boolean |
hasImport(AbstractJType type) |
(package private) boolean |
hasImport(java.lang.String name) |
(package private) boolean |
hasStaticImport(java.lang.String name) |
(package private) boolean |
hasStaticImport(java.lang.String name,
AbstractJType enclosingType) |
JSourceFile |
importStatic(java.lang.Class<?> type,
java.lang.String member)
Add a static member import to this source file.
|
JSourceFile |
importStatic(JType type,
java.lang.String member)
Add a static member import to this source file.
|
JSourceFile |
importStatic(java.lang.String type,
java.lang.String member)
Add a static member import to this source file.
|
(package private) void |
write(SourceFileWriter sourceFileWriter) |
blockComment, lineComment, writeComments
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
blockComment, lineComment
private final ImplJSources sources
private final java.util.Map<java.lang.String,AbstractJType> imports
private final java.util.Map<java.lang.String,StaticRefJExpr> staticImports
private final java.util.ArrayList<ClassFileContent> content
private final java.lang.String packageName
private final java.lang.String fileName
private boolean packageWritten
ImplJSourceFile(ImplJSources sources, java.lang.String packageName, java.lang.String fileName)
private <C extends ClassFileContent> C add(C item)
private void checkPackage()
boolean hasImport(java.lang.String name)
boolean hasImport(AbstractJType type)
boolean hasStaticImport(java.lang.String name)
boolean hasStaticImport(java.lang.String name, AbstractJType enclosingType)
public JSourceFile _import(java.lang.String type)
JSourceFile
_import
in interface JSourceFile
type
- the type to importpublic JSourceFile _import(JType type)
JSourceFile
_import
in interface JSourceFile
type
- the type to importpublic JSourceFile _import(java.lang.Class<?> type)
JSourceFile
_import
in interface JSourceFile
type
- the type to importpublic JSourceFile importStatic(java.lang.String type, java.lang.String member)
JSourceFile
importStatic
in interface JSourceFile
type
- the type to import frommember
- the member namepublic JSourceFile importStatic(JType type, java.lang.String member)
JSourceFile
importStatic
in interface JSourceFile
type
- the type to import frommember
- the member namepublic JSourceFile importStatic(java.lang.Class<?> type, java.lang.String member)
JSourceFile
importStatic
in interface JSourceFile
type
- the type to import frommember
- the member namepublic JSourceFile blankLine()
JSourceFile
blankLine
in interface JSourceFile
public JClassDef _class(int mods, java.lang.String name)
JSourceFile
_class
in interface JSourceFile
mods
- the modifiersname
- the class namepublic JClassDef _enum(int mods, java.lang.String name)
JSourceFile
_enum
in interface JSourceFile
mods
- the modifiersname
- the enum namepublic JClassDef _interface(int mods, java.lang.String name)
JSourceFile
_interface
in interface JSourceFile
mods
- the modifiersname
- the interface namepublic JClassDef annotationInterface(int mods, java.lang.String name)
JSourceFile
annotationInterface
in interface JSourceFile
mods
- the modifiersname
- the annotation interface namejava.lang.String getPackageName()
java.lang.String getFileName()
void write(SourceFileWriter sourceFileWriter) throws java.io.IOException
java.io.IOException
ImplJSources getSources()