com.togethersoft.sca.ast
Interface AstObjectCreationExpression

All Superinterfaces:
AstExpression, AstObject, AstReference

public interface AstObjectCreationExpression
extends AstExpression, AstReference

Represents a new object creation expression. For example:

     ArrayList list = new ArrayList(10);
 


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
 AstExpression[] getArguments()
          Returns arguments to the constructor invocation.
 AstExpression getBase()
          Returns the base expression if this object creation expression is qualified.
 AstType getClassBody()
          Returns the anonymous class declaration.
 AstType getObjectType()
          Returns the type of the object being created.
 AstDeclaration getReferencedElement()
          Returns the constructor that is invoked by this expression.
 
Methods inherited from interface com.togethersoft.sca.ast.AstExpression
getOperands, getRuntimeType, getType, isConstant
 
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

getArguments

public AstExpression[] getArguments()
Returns arguments to the constructor invocation. Returns an empty array if no arguments are provided.
Returns:
the constructor arguments.

getBase

public AstExpression getBase()
Returns the base expression if this object creation expression is qualified. Returns null otherwise.

For the following example, getBase will return the expression that corresponds to the selected fragment:

     Inner inner = this.new Inner();
 
Returns:
the base expression.

getClassBody

public AstType getClassBody()
Returns the anonymous class declaration. Returns null if this expression does not declare an anonymous class.

For the following example, getClassBody will return the class that corresponds to the selected fragment:

     Observer o = new Observer() {
         public void update(Observable o, Object arg) {}
     };
 
Returns:
the anonymous class declaration.

getObjectType

public AstType getObjectType()
Returns the type of the object being created.
Returns:
the type of the created object.

getReferencedElement

public AstDeclaration getReferencedElement()
Returns the constructor that is invoked by this expression. This will return null if the constructor is not found.
Specified by:
getReferencedElement in interface AstReference
Returns:
the called constructor.
See Also:
AstMethod