public final class ObjectCreationExpr extends Expression implements NodeWithTypeArguments<ObjectCreationExpr>, NodeWithType<ObjectCreationExpr,ClassOrInterfaceType>, NodeWithArguments<ObjectCreationExpr>
new HashMap.Entry(15) {public String getKey() {return null;}};
HashMap is the scope, Entry is the type, String and Long are type arguments, 15 is an argument, and everything in { }
is the anonymous class body.Node.ObserverRegistrationMode
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, NODE_BY_BEGIN_POSITION, prettyPrinterNoCommentsConfiguration
Constructor and Description |
---|
ObjectCreationExpr() |
ObjectCreationExpr(Expression scope,
ClassOrInterfaceType type,
NodeList<Expression> arguments)
Defines a call to a constructor.
|
ObjectCreationExpr(Range range,
Expression scope,
ClassOrInterfaceType type,
NodeList<Type> typeArguments,
NodeList<Expression> arguments,
NodeList<BodyDeclaration<?>> anonymousBody) |
Modifier and Type | Method and Description |
---|---|
<R,A> R |
accept(GenericVisitor<R,A> v,
A arg)
Accept method for visitor support.
|
<A> void |
accept(VoidVisitor<A> v,
A arg)
Accept method for visitor support.
|
void |
addAnonymousClassBody(BodyDeclaration<?> body) |
Optional<NodeList<BodyDeclaration<?>>> |
getAnonymousClassBody() |
NodeList<Expression> |
getArguments() |
Optional<Expression> |
getScope() |
ClassOrInterfaceType |
getType()
Gets the type
|
Optional<NodeList<Type>> |
getTypeArguments() |
ObjectCreationExpr |
setAnonymousClassBody(NodeList<BodyDeclaration<?>> anonymousClassBody)
Sets the anonymousClassBody
Null means no class body Empty NodeList means new ClassName(){ } |
ObjectCreationExpr |
setArguments(NodeList<Expression> arguments) |
ObjectCreationExpr |
setScope(Expression scope)
Sets the scope
|
ObjectCreationExpr |
setType(ClassOrInterfaceType type)
Sets the type
|
ObjectCreationExpr |
setTypeArguments(NodeList<Type> typeArguments)
Sets the typeArguments
|
addOrphanComment, clone, containsWithin, equals, getAllContainedComments, getBegin, getChildNodes, getComment, getData, getEnd, getNodeLists, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getRange, hasComment, hashCode, hasJavaDocComment, isPositionedAfter, isPositionedBefore, isRegistered, notifyPropertyChange, register, register, registerForSubtree, remove, removeOrphanComment, setAsParentNodeOf, setBlockComment, setComment, setData, setLineComment, setParentNode, setRange, toString, toString, tryAddImportToParentCompilationUnit, unregister
finalize, getClass, notify, notifyAll, wait, wait, wait
isUsingDiamondOperator, removeTypeArguments, setDiamondOperator, setTypeArguments
setType, setType
addArgument, addArgument, getArgument, setArgument
getAncestorOfType, setAsParentNodeOf, setAsParentNodeOf
public ObjectCreationExpr()
public ObjectCreationExpr(Expression scope, ClassOrInterfaceType type, NodeList<Expression> arguments)
scope
- may be nulltype
- this is the class that the constructor is being called for.arguments
- Any arguments to pass to the constructorpublic ObjectCreationExpr(Range range, Expression scope, ClassOrInterfaceType type, NodeList<Type> typeArguments, NodeList<Expression> arguments, NodeList<BodyDeclaration<?>> anonymousBody)
public <R,A> R accept(GenericVisitor<R,A> v, A arg)
Visitable
accept
in interface Visitable
R
- the type of the return value of the visitorA
- the type the user argument passed to the visitorv
- the visitor implementationarg
- the argument passed to the visitor (of type A)public <A> void accept(VoidVisitor<A> v, A arg)
Visitable
public Optional<NodeList<BodyDeclaration<?>>> getAnonymousClassBody()
public void addAnonymousClassBody(BodyDeclaration<?> body)
public NodeList<Expression> getArguments()
getArguments
in interface NodeWithArguments<ObjectCreationExpr>
public Optional<Expression> getScope()
public ClassOrInterfaceType getType()
NodeWithType
getType
in interface NodeWithType<ObjectCreationExpr,ClassOrInterfaceType>
public ObjectCreationExpr setAnonymousClassBody(NodeList<BodyDeclaration<?>> anonymousClassBody)
anonymousClassBody
- the anonymousClassBody, can be null or emptypublic ObjectCreationExpr setArguments(NodeList<Expression> arguments)
setArguments
in interface NodeWithArguments<ObjectCreationExpr>
public ObjectCreationExpr setScope(Expression scope)
scope
- the scope, can be nullpublic ObjectCreationExpr setType(ClassOrInterfaceType type)
NodeWithType
setType
in interface NodeWithType<ObjectCreationExpr,ClassOrInterfaceType>
type
- the typepublic Optional<NodeList<Type>> getTypeArguments()
getTypeArguments
in interface NodeWithTypeArguments<ObjectCreationExpr>
public ObjectCreationExpr setTypeArguments(NodeList<Type> typeArguments)
setTypeArguments
in interface NodeWithTypeArguments<ObjectCreationExpr>
typeArguments
- the typeArguments, can be nullCopyright © 2007–2017. All rights reserved.