com.togethersoft.sca.ast
Interface AstCompilationUnit
- All Superinterfaces:
- AstDeclaration, AstElement, AstObject
- public interface AstCompilationUnit
- extends AstDeclaration
Represents a compilation unit (Java source file). A compilation unit
contains a collection of types (classes and interfaces) represented by
AstType objects.
| Fields inherited from interface com.togethersoft.sca.ast.AstObject |
ARRAY_CREATION, ARRAY_INITIALIZER, ARRAY_REFERENCE, ASSERT_STATEMENT, ASSIGNMENT_EXPRESSION, BINARY_EXPRESSION, BREAK_STATEMENT, CASE_LABEL, CAST_EXPRESSION, CATCH_CLAUSE, CLASS_FILE, COMMENT, COMPILATION_UNIT, COMPOUND_STATEMENT, CONDITIONAL_EXPRESSION, CONSTRUCTOR_INVOCATION, CONTINUE_STATEMENT, DBC_RESULT, DECLARATION_STATEMENT, DO_STATEMENT, EMPTY_STATEMENT, EXPRESSION_STATEMENT, FIELD_REFERENCE, FINALLY_CLAUSE, FOR_STATEMENT, IF_STATEMENT, IMPORT, INITIALIZER, JAVADOC_TAG, LITERAL, METHOD, METHOD_CALL_EXPRESSION, N_A, OBJECT_CREATION_EXPRESSION, PACKAGE, PARENTHESIZED_EXPRESSION, RETURN_STATEMENT, SIMPLE_REFERENCE, SUPER_EXPRESSION, SWITCH_GROUP, SWITCH_STATEMENT, SYNCHRONIZED_STATEMENT, THIS_EXPRESSION, THROW_SPECIFIER, THROW_STATEMENT, TRY_STATEMENT, TYPE, TYPE_EXPRESSION, UNARY_EXPRESSION, VARIABLE, VARIABLE_DECLARATION, WHILE_STATEMENT |
|
Method Summary |
java.lang.String |
getElementName()
Returns the file name of this compilation unit. |
AstImport[] |
getImports()
Returns the import declarations in this compilation unit
in the order in which they appear in the source. |
AstType[] |
getTypes()
Returns all types declared in this compilation unit in the order
in which they appear in the source. |
boolean |
writeFile(java.io.OutputStream s)
Writes the (possibly modified) contents of this compilation unit to
the specified output stream. |
| Methods inherited from interface com.togethersoft.sca.ast.AstDeclaration |
getDeclaredModifiers, getModifiers, getModifiersList, getReferences, isAbstract, isFinal, isNative, isPackage, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile, setDeclaredModifiers, swapWith |
| Methods inherited from interface com.togethersoft.sca.ast.AstObject |
addComment, getChildren, getComments, getCompilationUnit, getDeclaringMethod, getDeclaringType, getObjectKind, getPackage, getParent, getPosition, isDeleted, remove, replaceWith, replaceWith, setPosition, setPositionAfter, visitExpressions, visitStatements |
getElementName
public java.lang.String getElementName()
- Returns the file name of this compilation unit.
- Specified by:
getElementName in interface AstElement
- Following copied from interface:
com.togethersoft.sca.ast.AstElement
- Returns:
- the name of this element.
getImports
public AstImport[] getImports()
- Returns the import declarations in this compilation unit
in the order in which they appear in the source.
- Returns:
- the import declarations.
getTypes
public AstType[] getTypes()
- Returns all types declared in this compilation unit in the order
in which they appear in the source.
This includes all top-level types and nested member types.
It does not include local types (types defined in methods).
- Returns:
- the declared types.
writeFile
public boolean writeFile(java.io.OutputStream s)
- Writes the (possibly modified) contents of this compilation unit to
the specified output stream.
- Returns:
true if the file was successfully written