public final class ObjectCreationExpr extends Expression implements NodeWithTypeArguments<ObjectCreationExpr>, NodeWithType<ObjectCreationExpr,ClassOrInterfaceType>, NodeWithArguments<ObjectCreationExpr>
new Object()
ABSOLUTE_BEGIN_LINE, ABSOLUTE_END_LINE, NODE_BY_BEGIN_POSITION
Constructor and Description |
---|
ObjectCreationExpr() |
ObjectCreationExpr(Optional<Expression> scope,
ClassOrInterfaceType type,
NodeList<Expression> args)
Defines a call to a constructor.
|
ObjectCreationExpr(Range range,
Optional<Expression> scope,
ClassOrInterfaceType type,
Optional<NodeList<Type<?>>> typeArguments,
NodeList<Expression> args,
Optional<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()
This can be null, to indicate there is no body
|
NodeList<Expression> |
getArgs() |
Optional<Expression> |
getScope() |
ClassOrInterfaceType |
getType()
Gets the type
|
Optional<NodeList<Type<?>>> |
getTypeArguments() |
ObjectCreationExpr |
setAnonymousClassBody(Optional<NodeList<BodyDeclaration<?>>> anonymousClassBody) |
ObjectCreationExpr |
setArgs(NodeList<Expression> args) |
ObjectCreationExpr |
setScope(Optional<Expression> scope) |
ObjectCreationExpr |
setType(ClassOrInterfaceType type)
Sets the type
|
ObjectCreationExpr |
setTypeArguments(Optional<NodeList<Type<?>>> typeArguments)
Allows you to set the generic arguments
|
addOrphanComment, clone, containsWithin, equals, getAllContainedComments, getBackwardsCompatibleChildrenNodes, getBegin, getChildrenNodes, getComment, getEnd, getNodesByType, getOrphanComments, getParentNode, getParentNodeOfType, getRange, getUserData, hashCode, isPositionedAfter, isPositionedBefore, remove, setAsParentNodeOf, setAsParentNodeOf, setAsParentNodeOf, setBegin, setBlockComment, setComment, setEnd, setLineComment, setParentNode, setRange, setUserData, toString, toStringWithoutComments, tryAddImportToParentCompilationUnit
finalize, getClass, notify, notifyAll, wait, wait, wait
isUsingDiamondOperator, removeTypeArguments, setDiamondOperator, setTypeArguments
setType, setType
addArgument, addArgument
public ObjectCreationExpr()
public ObjectCreationExpr(Optional<Expression> scope, ClassOrInterfaceType type, NodeList<Expression> args)
scope
- may be nulltype
- this is the class that the constructor is being called for.args
- Any arguments to pass to the constructorpublic ObjectCreationExpr(Range range, Optional<Expression> scope, ClassOrInterfaceType type, Optional<NodeList<Type<?>>> typeArguments, NodeList<Expression> args, Optional<NodeList<BodyDeclaration<?>>> anonymousBody)
public <R,A> R accept(GenericVisitor<R,A> v, A arg)
Node
public <A> void accept(VoidVisitor<A> v, A arg)
Node
public Optional<NodeList<BodyDeclaration<?>>> getAnonymousClassBody()
public void addAnonymousClassBody(BodyDeclaration<?> body)
public NodeList<Expression> getArgs()
getArgs
in interface NodeWithArguments<ObjectCreationExpr>
public Optional<Expression> getScope()
public ClassOrInterfaceType getType()
NodeWithType
getType
in interface NodeWithType<ObjectCreationExpr,ClassOrInterfaceType>
public ObjectCreationExpr setAnonymousClassBody(Optional<NodeList<BodyDeclaration<?>>> anonymousClassBody)
public ObjectCreationExpr setArgs(NodeList<Expression> args)
setArgs
in interface NodeWithArguments<ObjectCreationExpr>
public ObjectCreationExpr setScope(Optional<Expression> scope)
public 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(Optional<NodeList<Type<?>>> typeArguments)
NodeWithTypeArguments
setTypeArguments
in interface NodeWithTypeArguments<ObjectCreationExpr>
typeArguments
- The list of types of the genericsCopyright © 2007–2016. All rights reserved.