com.togethersoft.sca.ast
Interface AstMethod

All Superinterfaces:
AstDbcProvider, AstDeclaration, AstElement, AstMember, AstObject
All Known Subinterfaces:
AstInitializer

public interface AstMethod
extends AstMember, AstDbcProvider

Represents a method or constructor declared in a type.


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
 AstCompoundStatement getBody()
          Returns the body of this method.
 java.lang.String getElementName()
          Returns the simple name of this method.
 AstTypeReference[] getExceptionTypes()
          Returns types of the exceptions this method throws, in the order declared in the source.
 AstMethod[] getOverridden()
          Returns all the methods this method overrides or implements.
 AstVariable[] getParameters()
          Returns the parameters of this method.
 java.lang.String getQualifiedName()
          Returns the fully qualified name of this method, including qualification for any containing types and packages.
 AstTypeReference getReturnType()
          Returns type of the return value of this method.
 java.lang.String getSignature()
          Returns the signature of the method.
 boolean isConstructor()
          Returns true if this is a constructor, false otherwise.
 boolean isErrorFree()
          Returns true if this method does not contain syntactic and semantic errors, all the referred types are successfully resolved.
 boolean isInitializer()
          Returns true if this is an initializer, false otherwise.
 AstMethod[] overriddenBy()
          Returns all the methods in the model that override or implement this method.
 
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
 
Methods inherited from interface com.togethersoft.sca.ast.AstDbcProvider
getInvariants, getPostconditions, getPreconditions
 

Method Detail

getBody

public AstCompoundStatement getBody()
Returns the body of this method. getBody will return null for abstract, native and binary methods.
Returns:
the body of this method.

getElementName

public java.lang.String getElementName()
Returns the simple name of this method. For a constructor, this returns the simple name of the declaring type. Note: This holds whether the constructor appears in a source or binary type (even though class files internally define constructor names to be "<init>"). For the class initialization methods in binary types, this returns the special name "<clinit>".
Specified by:
getElementName in interface AstElement
Returns:
the simple name of this method.

getExceptionTypes

public AstTypeReference[] getExceptionTypes()
Returns types of the exceptions this method throws, in the order declared in the source. Returns an empty array if this method throws no exceptions.
Returns:
the exceptions thrown by this method.

getOverridden

public AstMethod[] getOverridden()
Returns all the methods this method overrides or implements. This includes methods declared in supertypes of this method's type that have the same name and signature.

The methods are returned in no particular order. An empty array is returned if this method does not override any methods.

Returns:
methods overriden by this method.

getParameters

public AstVariable[] getParameters()
Returns the parameters of this method. Returns an empty array if this method has no parameters.
Returns:
the parameters of this method.

getQualifiedName

public java.lang.String getQualifiedName()
Returns the fully qualified name of this method, including qualification for any containing types and packages.
Specified by:
getQualifiedName in interface AstMember
Returns:
the qualified name of this method.

getReturnType

public AstTypeReference getReturnType()
Returns type of the return value of this method. This returns the void type for constructors and initializers.
Returns:
the return type of this method.

getSignature

public java.lang.String getSignature()
Returns the signature of the method. The signature format is described in Section 4.3.3 of The JavaTM Virtual Machine Specification. In addition, '#' character is used to represent the bad type that cannot be evaluated.

For example, a source method declared as public void foo(String text, int length) would return "(Ljava/lang/String;I)V".

Returns:
the signature of this method.

isConstructor

public boolean isConstructor()
Returns true if this is a constructor, false otherwise.
Returns:
true if this is a constructor.

isErrorFree

public boolean isErrorFree()
Returns true if this method does not contain syntactic and semantic errors, all the referred types are successfully resolved.

isInitializer

public boolean isInitializer()
Returns true if this is an initializer, false otherwise.
Returns:
true if this is a class initializer.

overriddenBy

public AstMethod[] overriddenBy()
Returns all the methods in the model that override or implement this method. This includes methods declared in classes and interfaces derived from this method's type that have the same name and signature.

The methods are returned in no particular order. An empty array is returned if no methods override this method.

Returns:
methods that override this method.