public final class ObjectCreationExpr extends Expression implements NodeWithTypeArguments<ObjectCreationExpr>, NodeWithType<ObjectCreationExpr,ClassOrInterfaceType>, NodeWithArguments<ObjectCreationExpr>, NodeWithOptionalScope<ObjectCreationExpr>
new HashMap.Entry<String, Long>(15) {public String getKey() {return null;}};
HashMap.Entry is the type, String and Long are type arguments, 15 is an argument, and everything in { }
is the anonymous class body.
In class B { class C { public void a() { new B().new C(); } } }
the scope is new B()
of ObjectCreationExpr new B().new C()
Node.ObserverRegistrationMode, Node.Parsedness
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(Expression scope,
ClassOrInterfaceType type,
NodeList<Type> typeArguments,
NodeList<Expression> arguments,
NodeList<BodyDeclaration<?>> anonymousClassBody) |
ObjectCreationExpr(TokenRange tokenRange,
Expression scope,
ClassOrInterfaceType type,
NodeList<Type> typeArguments,
NodeList<Expression> arguments,
NodeList<BodyDeclaration<?>> anonymousClassBody)
This constructor is used by the parser and is considered private.
|
addOrphanComment, customInitialization, equals, getAllContainedComments, getChildNodes, getChildNodesByType, getComment, getData, getNodesByType, getOrphanComments, getParentNode, getParentNodeForChildren, getParsed, getRange, getTokenRange, hasComment, hashCode, isRegistered, notifyPropertyChange, register, register, registerForSubtree, remove, removeComment, removeForced, removeOrphanComment, setAsParentNodeOf, setAsParentNodeOf, setBlockComment, setComment, setData, setLineComment, setParentNode, setParsed, setRange, setTokenRange, toString, toString, tryAddImportToParentCompilationUnit, unregister
finalize, getClass, notify, notifyAll, wait, wait, wait
isUsingDiamondOperator, removeTypeArguments, setDiamondOperator, setTypeArguments
setType, setType, tryAddImportToParentCompilationUnit
addArgument, addArgument, getArgument, setArgument
getAncestorOfType
containsWithin, getBegin, getEnd, isPositionedAfter, isPositionedBefore
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(Expression scope, ClassOrInterfaceType type, NodeList<Type> typeArguments, NodeList<Expression> arguments, NodeList<BodyDeclaration<?>> anonymousClassBody)
@Generated(value="com.github.javaparser.generator.core.node.MainConstructorGenerator") public ObjectCreationExpr(TokenRange tokenRange, Expression scope, ClassOrInterfaceType type, NodeList<Type> typeArguments, NodeList<Expression> arguments, NodeList<BodyDeclaration<?>> anonymousClassBody)
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
@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public Optional<NodeList<BodyDeclaration<?>>> getAnonymousClassBody()
public void addAnonymousClassBody(BodyDeclaration<?> body)
@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public NodeList<Expression> getArguments()
getArguments
in interface NodeWithArguments<ObjectCreationExpr>
@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public Optional<Expression> getScope()
getScope
in interface NodeWithOptionalScope<ObjectCreationExpr>
@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public ClassOrInterfaceType getType()
NodeWithType
getType
in interface NodeWithType<ObjectCreationExpr,ClassOrInterfaceType>
@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public ObjectCreationExpr setAnonymousClassBody(NodeList<BodyDeclaration<?>> anonymousClassBody)
anonymousClassBody
- the anonymousClassBody, can be null or empty@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public ObjectCreationExpr setArguments(NodeList<Expression> arguments)
setArguments
in interface NodeWithArguments<ObjectCreationExpr>
@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public ObjectCreationExpr setScope(Expression scope)
setScope
in interface NodeWithOptionalScope<ObjectCreationExpr>
scope
- the scope, can be null@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public ObjectCreationExpr setType(ClassOrInterfaceType type)
NodeWithType
setType
in interface NodeWithType<ObjectCreationExpr,ClassOrInterfaceType>
type
- the type@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public Optional<NodeList<Type>> getTypeArguments()
getTypeArguments
in interface NodeWithTypeArguments<ObjectCreationExpr>
@Generated(value="com.github.javaparser.generator.core.node.PropertyGenerator") public ObjectCreationExpr setTypeArguments(NodeList<Type> typeArguments)
setTypeArguments
in interface NodeWithTypeArguments<ObjectCreationExpr>
typeArguments
- the typeArguments, can be null@Generated(value="com.github.javaparser.generator.core.node.GetNodeListsGenerator") public List<NodeList<?>> getNodeLists()
Node
getNodeLists
in class Node
@Generated(value="com.github.javaparser.generator.core.node.RemoveMethodGenerator") public boolean remove(Node node)
remove
in class Expression
@Generated(value="com.github.javaparser.generator.core.node.RemoveMethodGenerator") public ObjectCreationExpr removeScope()
removeScope
in interface NodeWithOptionalScope<ObjectCreationExpr>
@Generated(value="com.github.javaparser.generator.core.node.CloneGenerator") public ObjectCreationExpr clone()
clone
in class Expression
@Generated(value="com.github.javaparser.generator.core.node.GetMetaModelGenerator") public ObjectCreationExprMetaModel getMetaModel()
getMetaModel
in class Expression
@Generated(value="com.github.javaparser.generator.core.node.ReplaceMethodGenerator") public boolean replace(Node node, Node replacementNode)
replace
in class Expression
Copyright © 2007–2017. All rights reserved.