Package org.jboss.jdeparser
Class ImplJSourceFile
- java.lang.Object
-
- org.jboss.jdeparser.BasicJCommentable
-
- org.jboss.jdeparser.ImplJSourceFile
-
- All Implemented Interfaces:
JCommentable
,JSourceFile
class ImplJSourceFile extends BasicJCommentable implements JSourceFile
-
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description ImplJSourceFile(ImplJSources sources, java.lang.String packageName, java.lang.String fileName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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(java.lang.String type)
Add a type import to this source file.JSourceFile
_import(JType 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>
Cadd(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(java.lang.String name)
(package private) boolean
hasImport(AbstractJType type)
(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(java.lang.String 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.(package private) void
write(SourceFileWriter sourceFileWriter)
-
Methods inherited from class org.jboss.jdeparser.BasicJCommentable
blockComment, lineComment, writeComments
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jboss.jdeparser.JCommentable
blockComment, lineComment
-
-
-
-
Field Detail
-
sources
private final ImplJSources sources
-
imports
private final java.util.Map<java.lang.String,AbstractJType> imports
-
staticImports
private final java.util.Map<java.lang.String,StaticRefJExpr> staticImports
-
content
private final java.util.ArrayList<ClassFileContent> content
-
packageName
private final java.lang.String packageName
-
fileName
private final java.lang.String fileName
-
packageWritten
private boolean packageWritten
-
-
Constructor Detail
-
ImplJSourceFile
ImplJSourceFile(ImplJSources sources, java.lang.String packageName, java.lang.String fileName)
-
-
Method Detail
-
add
private <C extends ClassFileContent> C add(C item)
-
checkPackage
private void checkPackage()
-
hasImport
boolean hasImport(java.lang.String name)
-
hasImport
boolean hasImport(AbstractJType type)
-
hasStaticImport
boolean hasStaticImport(java.lang.String name)
-
hasStaticImport
boolean hasStaticImport(java.lang.String name, AbstractJType enclosingType)
-
_import
public JSourceFile _import(java.lang.String type)
Description copied from interface:JSourceFile
Add a type import to this source file.- Specified by:
_import
in interfaceJSourceFile
- Parameters:
type
- the type to import- Returns:
- this source file
-
_import
public JSourceFile _import(JType type)
Description copied from interface:JSourceFile
Add a type import to this source file.- Specified by:
_import
in interfaceJSourceFile
- Parameters:
type
- the type to import- Returns:
- this source file
-
_import
public JSourceFile _import(java.lang.Class<?> type)
Description copied from interface:JSourceFile
Add a type import to this source file.- Specified by:
_import
in interfaceJSourceFile
- Parameters:
type
- the type to import- Returns:
- this source file
-
importStatic
public JSourceFile importStatic(java.lang.String type, java.lang.String member)
Description copied from interface:JSourceFile
Add a static member import to this source file.- Specified by:
importStatic
in interfaceJSourceFile
- Parameters:
type
- the type to import frommember
- the member name- Returns:
- this source file
-
importStatic
public JSourceFile importStatic(JType type, java.lang.String member)
Description copied from interface:JSourceFile
Add a static member import to this source file.- Specified by:
importStatic
in interfaceJSourceFile
- Parameters:
type
- the type to import frommember
- the member name- Returns:
- this source file
-
importStatic
public JSourceFile importStatic(java.lang.Class<?> type, java.lang.String member)
Description copied from interface:JSourceFile
Add a static member import to this source file.- Specified by:
importStatic
in interfaceJSourceFile
- Parameters:
type
- the type to import frommember
- the member name- Returns:
- this source file
-
blankLine
public JSourceFile blankLine()
Description copied from interface:JSourceFile
Add a blank line to this source file. If sorting is enabled, blank lines may be lost.- Specified by:
blankLine
in interfaceJSourceFile
- Returns:
- this source file
-
_class
public JClassDef _class(int mods, java.lang.String name)
Description copied from interface:JSourceFile
Add a class definition to this source file.- Specified by:
_class
in interfaceJSourceFile
- Parameters:
mods
- the modifiersname
- the class name- Returns:
- the class definition
-
_enum
public JClassDef _enum(int mods, java.lang.String name)
Description copied from interface:JSourceFile
Add an enum definition to this source file.- Specified by:
_enum
in interfaceJSourceFile
- Parameters:
mods
- the modifiersname
- the enum name- Returns:
- the enum definition
-
_interface
public JClassDef _interface(int mods, java.lang.String name)
Description copied from interface:JSourceFile
Add an interface definition to this source file.- Specified by:
_interface
in interfaceJSourceFile
- Parameters:
mods
- the modifiersname
- the interface name- Returns:
- the interface definition
-
annotationInterface
public JClassDef annotationInterface(int mods, java.lang.String name)
Description copied from interface:JSourceFile
Add an annotation interface definition to this source file.- Specified by:
annotationInterface
in interfaceJSourceFile
- Parameters:
mods
- the modifiersname
- the annotation interface name- Returns:
- the annotation interface definition
-
getPackageName
java.lang.String getPackageName()
-
getFileName
java.lang.String getFileName()
-
write
void write(SourceFileWriter sourceFileWriter) throws java.io.IOException
- Throws:
java.io.IOException
-
getSources
ImplJSources getSources()
-
-