com.togethersoft.sca.ast
Interface AstDeclaration

All Superinterfaces:
AstElement, AstObject
All Known Subinterfaces:
AstCompilationUnit, AstField, AstInitializer, AstMember, AstMethod, AstPackage, AstType, AstVarDeclaration, AstVariable

public interface AstDeclaration
extends AstElement

The common interface representing a declaration. A declaration has a set of access modifiers associated with it. For each declaration a list fo AST objects referring to it can be obtained.


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
 int getDeclaredModifiers()
          Returns this declaration's explicitly specified modifiers.
 int getModifiers()
          Returns this declaration's modifiers.
 AstModifier[] getModifiersList()
          Return array of declared modifiers
 AstReference[] getReferences()
          Returns an array of objects that refers to this declaration.
 boolean isAbstract()
          Returns true if this declaration has the abstract modifier.
 boolean isFinal()
          Returns true if this declaration has the final modifier.
 boolean isNative()
          Returns true if this declaration has the native modifier.
 boolean isPackage()
          Returns true if this declaration has default access.
 boolean isPrivate()
          Returns true if this declaration has the private modifier.
 boolean isProtected()
          Returns true if this declaration has the protected modifier.
 boolean isPublic()
          Returns true if this declaration has the public modifier.
 boolean isStatic()
          Returns true if this declaration has the static modifier.
 boolean isStrictfp()
          Returns true if this declaration has the strictfp modifier.
 boolean isSynchronized()
          Returns true if this declaration has the synchronized modifier.
 boolean isTransient()
          Returns true if this declaration has the transient modifier.
 boolean isVolatile()
          Returns true if this declaration has the volatile modifier.
 void setDeclaredModifiers(int modifiers)
          Alter set of declaration modifiers
 void swapWith(AstDeclaration anotherDecl)
          Swap location of two declations
 
Methods inherited from interface com.togethersoft.sca.ast.AstElement
getElementName
 
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
 

Method Detail

getDeclaredModifiers

public int getDeclaredModifiers()
Returns this declaration's explicitly specified modifiers. The modifiers are represented by the flags defined in the AstModifiers interface.

The returned value includes only modifiers explicitly declared in the source code.

Returns:
the declaration's modifiers.

getModifiers

public int getModifiers()
Returns this declaration's modifiers. The modifiers are represented by the flags defined in the AstModifiers interface.

The returned value includes implicit modifiers such as the abstract modifier of interface methods.

Returns:
the declaration's modifiers.

getModifiersList

public AstModifier[] getModifiersList()
Return array of declared modifiers
Returns:
AstModifier[]

getReferences

public AstReference[] getReferences()
Returns an array of objects that refers to this declaration. Returns an empty array if this declaration is not referred to.
Returns:
the list of referring AST objects.

isAbstract

public boolean isAbstract()
Returns true if this declaration has the abstract modifier.
Returns:
true if this declaration is abstract.

isFinal

public boolean isFinal()
Returns true if this declaration has the final modifier.
Returns:
true if this declaration is final.

isNative

public boolean isNative()
Returns true if this declaration has the native modifier.
Returns:
true if this declaration is native.

isPackage

public boolean isPackage()
Returns true if this declaration has default access.
Returns:
true if this declaration has default access.

isPrivate

public boolean isPrivate()
Returns true if this declaration has the private modifier.
Returns:
true if this declaration is private.

isProtected

public boolean isProtected()
Returns true if this declaration has the protected modifier.
Returns:
true if this declaration is protected.

isPublic

public boolean isPublic()
Returns true if this declaration has the public modifier.
Returns:
true if this declaration is public.

isStatic

public boolean isStatic()
Returns true if this declaration has the static modifier.
Returns:
true if this declaration is static.

isStrictfp

public boolean isStrictfp()
Returns true if this declaration has the strictfp modifier.
Returns:
true if this declaration is strictfp.

isSynchronized

public boolean isSynchronized()
Returns true if this declaration has the synchronized modifier.
Returns:
true if this declaration is synchronized.

isTransient

public boolean isTransient()
Returns true if this declaration has the transient modifier.
Returns:
true if this declaration is transient.

isVolatile

public boolean isVolatile()
Returns true if this declaration has the volatile modifier.
Returns:
true if this declaration is volatile.

setDeclaredModifiers

public void setDeclaredModifiers(int modifiers)
Alter set of declaration modifiers
Parameters:
modifiers - new modifiers of declaration

swapWith

public void swapWith(AstDeclaration anotherDecl)
Swap location of two declations
Parameters:
anotherDecl - declaration with which this declaration will be swapped