|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
package com.github.javaparser.ast.stmt; |
|
|
|
import com.github.javaparser.TokenRange; |
|
import com.github.javaparser.ast.AllFieldsConstructor; |
|
import com.github.javaparser.ast.Generated; |
|
import com.github.javaparser.ast.Node; |
|
import com.github.javaparser.ast.NodeList; |
|
import com.github.javaparser.ast.expr.*; |
|
import com.github.javaparser.ast.nodeTypes.NodeWithArguments; |
|
import com.github.javaparser.ast.nodeTypes.NodeWithTypeArguments; |
|
import com.github.javaparser.ast.observer.ObservableProperty; |
|
import com.github.javaparser.ast.type.Type; |
|
import com.github.javaparser.ast.visitor.CloneVisitor; |
|
import com.github.javaparser.ast.visitor.GenericVisitor; |
|
import com.github.javaparser.ast.visitor.VoidVisitor; |
|
import com.github.javaparser.metamodel.ExplicitConstructorInvocationStmtMetaModel; |
|
import com.github.javaparser.metamodel.JavaParserMetaModel; |
|
import com.github.javaparser.metamodel.OptionalProperty; |
|
import com.github.javaparser.resolution.Resolvable; |
|
import com.github.javaparser.resolution.UnsolvedSymbolException; |
|
import com.github.javaparser.resolution.declarations.ResolvedConstructorDeclaration; |
|
import java.util.Optional; |
|
import java.util.function.Consumer; |
|
import static com.github.javaparser.utils.Utils.assertNotNull; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
public class ExplicitConstructorInvocationStmt extends Statement implements NodeWithTypeArguments<ExplicitConstructorInvocationStmt>, NodeWithArguments<ExplicitConstructorInvocationStmt>, Resolvable<ResolvedConstructorDeclaration> { |
|
|
|
@OptionalProperty |
|
private NodeList<Type> typeArguments; |
|
|
|
private boolean isThis; |
|
|
|
@OptionalProperty |
|
private Expression expression; |
|
|
|
private NodeList<Expression> arguments; |
|
|
|
public ExplicitConstructorInvocationStmt() { |
|
this(null, null, true, null, new NodeList<>()); |
|
} |
|
|
|
public ExplicitConstructorInvocationStmt(final boolean isThis, final Expression expression, final NodeList<Expression> arguments) { |
|
this(null, null, isThis, expression, arguments); |
|
} |
|
|
|
@AllFieldsConstructor |
|
public ExplicitConstructorInvocationStmt(final NodeList<Type> typeArguments, final boolean isThis, final Expression expression, final NodeList<Expression> arguments) { |
|
this(null, typeArguments, isThis, expression, arguments); |
|
} |
|
|
|
|
|
|
|
*/ |
|
@Generated("com.github.javaparser.generator.core.node.MainConstructorGenerator") |
|
public ExplicitConstructorInvocationStmt(TokenRange tokenRange, NodeList<Type> typeArguments, boolean isThis, Expression expression, NodeList<Expression> arguments) { |
|
super(tokenRange); |
|
setTypeArguments(typeArguments); |
|
setThis(isThis); |
|
setExpression(expression); |
|
setArguments(arguments); |
|
customInitialization(); |
|
} |
|
|
|
@Override |
|
@Generated("com.github.javaparser.generator.core.node.AcceptGenerator") |
|
public <R, A> R accept(final GenericVisitor<R, A> v, final A arg) { |
|
return v.visit(this, arg); |
|
} |
|
|
|
@Override |
|
@Generated("com.github.javaparser.generator.core.node.AcceptGenerator") |
|
public <A> void accept(final VoidVisitor<A> v, final A arg) { |
|
v.visit(this, arg); |
|
} |
|
|
|
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") |
|
public NodeList<Expression> getArguments() { |
|
return arguments; |
|
} |
|
|
|
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") |
|
public Optional<Expression> getExpression() { |
|
return Optional.ofNullable(expression); |
|
} |
|
|
|
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") |
|
public boolean isThis() { |
|
return isThis; |
|
} |
|
|
|
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") |
|
public ExplicitConstructorInvocationStmt setArguments(final NodeList<Expression> arguments) { |
|
assertNotNull(arguments); |
|
if (arguments == this.arguments) { |
|
return this; |
|
} |
|
notifyPropertyChange(ObservableProperty.ARGUMENTS, this.arguments, arguments); |
|
if (this.arguments != null) |
|
this.arguments.setParentNode(null); |
|
this.arguments = arguments; |
|
setAsParentNodeOf(arguments); |
|
return this; |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") |
|
public ExplicitConstructorInvocationStmt setExpression(final Expression expression) { |
|
if (expression == this.expression) { |
|
return this; |
|
} |
|
notifyPropertyChange(ObservableProperty.EXPRESSION, this.expression, expression); |
|
if (this.expression != null) |
|
this.expression.setParentNode(null); |
|
this.expression = expression; |
|
setAsParentNodeOf(expression); |
|
return this; |
|
} |
|
|
|
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") |
|
public ExplicitConstructorInvocationStmt setThis(final boolean isThis) { |
|
if (isThis == this.isThis) { |
|
return this; |
|
} |
|
notifyPropertyChange(ObservableProperty.THIS, this.isThis, isThis); |
|
this.isThis = isThis; |
|
return this; |
|
} |
|
|
|
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") |
|
public Optional<NodeList<Type>> getTypeArguments() { |
|
return Optional.ofNullable(typeArguments); |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
@Generated("com.github.javaparser.generator.core.node.PropertyGenerator") |
|
public ExplicitConstructorInvocationStmt setTypeArguments(final NodeList<Type> typeArguments) { |
|
if (typeArguments == this.typeArguments) { |
|
return this; |
|
} |
|
notifyPropertyChange(ObservableProperty.TYPE_ARGUMENTS, this.typeArguments, typeArguments); |
|
if (this.typeArguments != null) |
|
this.typeArguments.setParentNode(null); |
|
this.typeArguments = typeArguments; |
|
setAsParentNodeOf(typeArguments); |
|
return this; |
|
} |
|
|
|
@Override |
|
@Generated("com.github.javaparser.generator.core.node.RemoveMethodGenerator") |
|
public boolean remove(Node node) { |
|
if (node == null) |
|
return false; |
|
for (int i = 0; i < arguments.size(); i++) { |
|
if (arguments.get(i) == node) { |
|
arguments.remove(i); |
|
return true; |
|
} |
|
} |
|
if (expression != null) { |
|
if (node == expression) { |
|
removeExpression(); |
|
return true; |
|
} |
|
} |
|
if (typeArguments != null) { |
|
for (int i = 0; i < typeArguments.size(); i++) { |
|
if (typeArguments.get(i) == node) { |
|
typeArguments.remove(i); |
|
return true; |
|
} |
|
} |
|
} |
|
return super.remove(node); |
|
} |
|
|
|
@Generated("com.github.javaparser.generator.core.node.RemoveMethodGenerator") |
|
public ExplicitConstructorInvocationStmt removeExpression() { |
|
return setExpression((Expression) null); |
|
} |
|
|
|
@Override |
|
@Generated("com.github.javaparser.generator.core.node.CloneGenerator") |
|
public ExplicitConstructorInvocationStmt clone() { |
|
return (ExplicitConstructorInvocationStmt) accept(new CloneVisitor(), null); |
|
} |
|
|
|
@Override |
|
@Generated("com.github.javaparser.generator.core.node.GetMetaModelGenerator") |
|
public ExplicitConstructorInvocationStmtMetaModel getMetaModel() { |
|
return JavaParserMetaModel.explicitConstructorInvocationStmtMetaModel; |
|
} |
|
|
|
@Override |
|
@Generated("com.github.javaparser.generator.core.node.ReplaceMethodGenerator") |
|
public boolean replace(Node node, Node replacementNode) { |
|
if (node == null) |
|
return false; |
|
for (int i = 0; i < arguments.size(); i++) { |
|
if (arguments.get(i) == node) { |
|
arguments.set(i, (Expression) replacementNode); |
|
return true; |
|
} |
|
} |
|
if (expression != null) { |
|
if (node == expression) { |
|
setExpression((Expression) replacementNode); |
|
return true; |
|
} |
|
} |
|
if (typeArguments != null) { |
|
for (int i = 0; i < typeArguments.size(); i++) { |
|
if (typeArguments.get(i) == node) { |
|
typeArguments.set(i, (Type) replacementNode); |
|
return true; |
|
} |
|
} |
|
} |
|
return super.replace(node, replacementNode); |
|
} |
|
|
|
@Override |
|
@Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator") |
|
public boolean isExplicitConstructorInvocationStmt() { |
|
return true; |
|
} |
|
|
|
@Override |
|
@Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator") |
|
public ExplicitConstructorInvocationStmt asExplicitConstructorInvocationStmt() { |
|
return this; |
|
} |
|
|
|
@Override |
|
@Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator") |
|
public void ifExplicitConstructorInvocationStmt(Consumer<ExplicitConstructorInvocationStmt> action) { |
|
action.accept(this); |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
public ResolvedConstructorDeclaration resolve() { |
|
return getSymbolResolver().resolveDeclaration(this, ResolvedConstructorDeclaration.class); |
|
} |
|
|
|
@Override |
|
@Generated("com.github.javaparser.generator.core.node.TypeCastingGenerator") |
|
public Optional<ExplicitConstructorInvocationStmt> toExplicitConstructorInvocationStmt() { |
|
return Optional.of(this); |
|
} |
|
} |