|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--openjava.ptree.ParseTreeObject | +--openjava.ptree.NonLeaf | +--openjava.ptree.AllocationExpression
The AllocationExpression
class represents
an expression which allocates a new object with its constructor.
This expression is like:
new String( "test" )
new String( "test" ){ public void hoge(){ ... } ... }
Expression
,
TypeName
,
ExpressionList
,
MemberDeclarationList
Field Summary |
Fields inherited from class openjava.ptree.NonLeaf |
|
Fields inherited from class openjava.ptree.ParseTreeObject |
debugFlag, debugLevel, LN, out, writerStack |
Constructor Summary | |
(package private) |
AllocationExpression()
|
|
AllocationExpression(Expression encloser,
TypeName typename,
ExpressionList args)
Allocates a new object with the class body. |
|
AllocationExpression(Expression encloser,
TypeName typename,
ExpressionList args,
MemberDeclarationList mdlst)
Allocates a new object with the class body. |
|
AllocationExpression(OJClass type,
ExpressionList args)
|
|
AllocationExpression(TypeName ctype,
ExpressionList args)
Allocates a new object without class body. |
|
AllocationExpression(TypeName typename,
ExpressionList args,
MemberDeclarationList mdlst)
Allocates a new object with the class body. |
Method Summary | |
void |
accept(ParseTreeVisitor v)
Accepts a ParseTreeVisitor object as the role of a
Visitor in the Visitor pattern, as the role of an Element in the
Visitor pattern. |
ExpressionList |
getArguments()
Gets the arguments of this constructor. |
MemberDeclarationList |
getClassBody()
Gets the class body of this constructor. |
TypeName |
getClassType()
Gets the class type of this constructor. |
Expression |
getEncloser()
Gets the expression of enclosing object. |
OJClass |
getType(Environment env)
|
void |
setArguments(ExpressionList args)
Sets the arguments of this constructor. |
void |
setClassBody(MemberDeclarationList mdlist)
Sets the class body of this constructor. |
void |
setClassType(TypeName ctype)
Sets the class type of this constructor. |
void |
setEncloser(Expression encloser)
Sets the expression of enclosing object. |
void |
writeCode()
Writes the code this parse-tree presents for. |
Methods inherited from class openjava.ptree.NonLeaf |
childrenAccept, childrenAreEqual, elementAt, equals, getComment, getContents, getLength, getRowType, makeRecursiveCopy, replaceChildWith, set, set, set, set, set, set, set, set, set, setComment, setElementAt |
Methods inherited from class openjava.ptree.ParseTreeObject |
clone, eq, eq, equal, flushPrintWriter, getDebugFlag, getNest, getObjectID, getParent, getPrintWriter, getTab, hashCode, lastObjectID, makeCopy, popNest, popPrintWriter, pushNest, pushPrintWriter, replace, setDebugFlag, setDebugLevel, setNest, setParent, setPrintStream, setTab, toFlattenString, toString, writeDebug, writeDebugL, writeDebugLln, writeDebugln, writeDebugLR, writeDebugR, writeDebugRln, writeTab |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface openjava.ptree.Expression |
getRowType |
Methods inherited from interface openjava.ptree.ParseTree |
childrenAccept, eq, equals, getObjectID, makeCopy, makeRecursiveCopy, replace, toFlattenString, toString |
Constructor Detail |
public AllocationExpression(Expression encloser, TypeName typename, ExpressionList args, MemberDeclarationList mdlst)
args
- argument list of constructormdlst
- the class body.
If this is null, no class body will be provided
this construct expression with.public AllocationExpression(TypeName typename, ExpressionList args, MemberDeclarationList mdlst)
args
- argument list of constructormdlst
- the class body.
If this is null, no class body will be provided
this construct expression with.public AllocationExpression(Expression encloser, TypeName typename, ExpressionList args)
args
- argument list of constructorpublic AllocationExpression(TypeName ctype, ExpressionList args)
ctype
- a class name to be constructedargs
- argument list of constructorpublic AllocationExpression(OJClass type, ExpressionList args)
AllocationExpression()
Method Detail |
public void writeCode()
NonLeaf
writeCode
in interface ParseTree
writeCode
in class NonLeaf
public Expression getEncloser()
public void setEncloser(Expression encloser)
encloser
- the expression of enclosing objectpublic TypeName getClassType()
public void setClassType(TypeName ctype)
ctype
- the class body to set.public ExpressionList getArguments()
public void setArguments(ExpressionList args)
public MemberDeclarationList getClassBody()
public void setClassBody(MemberDeclarationList mdlist)
mdlist
- the member declaration list of the class body.
If this is null, the class body will disappear.public OJClass getType(Environment env) throws Exception
getType
in interface Expression
Exception
public void accept(ParseTreeVisitor v) throws ParseTreeException
ParseTree
ParseTreeVisitor
object as the role of a
Visitor in the Visitor pattern, as the role of an Element in the
Visitor pattern.
This invoke an appropriate visit()
method on the
accepted visitor.
accept
in interface ParseTree
accept
in class ParseTreeObject
v
- a visitor
ParseTreeException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |