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>contentprivate java.lang.StringfileNameprivate java.util.Map<java.lang.String,AbstractJType>importsprivate java.lang.StringpackageNameprivate booleanpackageWrittenprivate ImplJSourcessourcesprivate 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)JClassDefannotationInterface(int mods, java.lang.String name)Add an annotation interface definition to this source file.JSourceFileblankLine()Add a blank line to this source file.private voidcheckPackage()(package private) java.lang.StringgetFileName()(package private) java.lang.StringgetPackageName()(package private) ImplJSourcesgetSources()(package private) booleanhasImport(java.lang.String name)(package private) booleanhasImport(AbstractJType type)(package private) booleanhasStaticImport(java.lang.String name)(package private) booleanhasStaticImport(java.lang.String name, AbstractJType enclosingType)JSourceFileimportStatic(java.lang.Class<?> type, java.lang.String member)Add a static member import to this source file.JSourceFileimportStatic(java.lang.String type, java.lang.String member)Add a static member import to this source file.JSourceFileimportStatic(JType type, java.lang.String member)Add a static member import to this source file.(package private) voidwrite(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:JSourceFileAdd a type import to this source file.- Specified by:
_importin interfaceJSourceFile- Parameters:
type- the type to import- Returns:
- this source file
-
_import
public JSourceFile _import(JType type)
Description copied from interface:JSourceFileAdd a type import to this source file.- Specified by:
_importin interfaceJSourceFile- Parameters:
type- the type to import- Returns:
- this source file
-
_import
public JSourceFile _import(java.lang.Class<?> type)
Description copied from interface:JSourceFileAdd a type import to this source file.- Specified by:
_importin 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:JSourceFileAdd a static member import to this source file.- Specified by:
importStaticin 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:JSourceFileAdd a static member import to this source file.- Specified by:
importStaticin 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:JSourceFileAdd a static member import to this source file.- Specified by:
importStaticin interfaceJSourceFile- Parameters:
type- the type to import frommember- the member name- Returns:
- this source file
-
blankLine
public JSourceFile blankLine()
Description copied from interface:JSourceFileAdd a blank line to this source file. If sorting is enabled, blank lines may be lost.- Specified by:
blankLinein interfaceJSourceFile- Returns:
- this source file
-
_class
public JClassDef _class(int mods, java.lang.String name)
Description copied from interface:JSourceFileAdd a class definition to this source file.- Specified by:
_classin 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:JSourceFileAdd an enum definition to this source file.- Specified by:
_enumin 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:JSourceFileAdd an interface definition to this source file.- Specified by:
_interfacein 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:JSourceFileAdd an annotation interface definition to this source file.- Specified by:
annotationInterfacein 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()
-
-