本文整理汇总了Java中com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt.isThis方法的典型用法代码示例。如果您正苦于以下问题:Java ExplicitConstructorInvocationStmt.isThis方法的具体用法?Java ExplicitConstructorInvocationStmt.isThis怎么用?Java ExplicitConstructorInvocationStmt.isThis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt
的用法示例。
在下文中一共展示了ExplicitConstructorInvocationStmt.isThis方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入方法依赖的package包/类
@Override
public void visit(final ExplicitConstructorInvocationStmt n, final Object arg) {
printer.printLn("ExplicitConstructorInvocationStmt");
printJavaComment(n.getComment(), arg);
if (n.isThis()) {
printTypeArgs(n.getTypeArgs(), arg);
printer.print("this");
} else {
if (n.getExpr() != null) {
n.getExpr().accept(this, arg);
printer.print(".");
}
printTypeArgs(n.getTypeArgs(), arg);
printer.print("super");
}
printArguments(n.getArgs(), arg);
printer.print(";");
}
示例2: visit
import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入方法依赖的package包/类
@Override public void visit(final ExplicitConstructorInvocationStmt n, final Object arg) {
printJavaComment(n.getComment(), arg);
if (n.isThis()) {
printTypeArgs(n.getTypeArgs(), arg);
printer.print("this");
} else {
if (n.getExpr() != null) {
n.getExpr().accept(this, arg);
printer.print(".");
}
printTypeArgs(n.getTypeArgs(), arg);
printer.print("super");
}
printArguments(n.getArgs(), arg);
printer.print(";");
}
示例3: visit
import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入方法依赖的package包/类
@Override public void visit(final ExplicitConstructorInvocationStmt n, final A arg) {
visitComment(n.getComment(), arg);
if (!n.isThis()) {
if (n.getExpr() != null) {
n.getExpr().accept(this, arg);
}
}
if (n.getTypeArgs() != null) {
for (final Type t : n.getTypeArgs()) {
t.accept(this, arg);
}
}
if (n.getArgs() != null) {
for (final Expression e : n.getArgs()) {
e.accept(this, arg);
}
}
}
示例4: visit
import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入方法依赖的package包/类
@Override public void visit(final ExplicitConstructorInvocationStmt n, final A arg) {
jw.write(n);
visitComment(n.getComment(), arg);
if (!n.isThis()) {
if (n.getExpr() != null) {
n.getExpr().accept(this, arg);
}
}
if (n.getTypeArgs() != null) {
for (final Type t : n.getTypeArgs()) {
t.accept(this, arg);
}
}
if (n.getArgs() != null) {
for (final Expression e : n.getArgs()) {
e.accept(this, arg);
}
}
}
示例5: visit
import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入方法依赖的package包/类
@Override public Node visit(final ExplicitConstructorInvocationStmt n, final A arg) {
if (!n.isThis()) {
if (n.getExpr() != null) {
n.setExpr((Expression) n.getExpr().accept(this, arg));
}
}
final List<Type> typeArgs = n.getTypeArgs();
if (typeArgs != null) {
for (int i = 0; i < typeArgs.size(); i++) {
typeArgs.set(i, (Type) typeArgs.get(i).accept(this, arg));
}
removeNulls(typeArgs);
}
final List<Expression> args = n.getArgs();
if (args != null) {
for (int i = 0; i < args.size(); i++) {
args.set(i, (Expression) args.get(i).accept(this, arg));
}
removeNulls(args);
}
return n;
}
示例6: visit
import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入方法依赖的package包/类
@Override
public Node visit(ExplicitConstructorInvocationStmt _n, Object _arg) {
List<Type<?>> typeArguments_ = visit(_n.getTypeArguments(), _arg);
Expression expr_ = cloneNodes(_n.getExpr(), _arg);
List<Expression> args_ = visit(_n.getArgs(), _arg);
Comment comment = cloneNodes(_n.getComment(), _arg);
ExplicitConstructorInvocationStmt r = new ExplicitConstructorInvocationStmt(
_n.getRange(),
typeArguments_,
_n.isThis(),
expr_,
args_
);
r.setComment(comment);
return r;
}
示例7: visit
import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入方法依赖的package包/类
@Override public Node visit(final ExplicitConstructorInvocationStmt n, final A arg) {
visitComment(n, arg);
if (!n.isThis() && n.getExpr() != null) {
n.setExpr((Expression) n.getExpr().accept(this, arg));
}
final List<Type<?>> typeArguments = n.getTypeArguments();
if (typeArguments != null) {
for (int i = 0; i < typeArguments.size(); i++) {
typeArguments.set(i, (Type<?>) typeArguments.get(i).accept(this, arg));
}
removeNulls(typeArguments);
}
final List<Expression> args = n.getArgs();
if (args != null) {
for (int i = 0; i < args.size(); i++) {
args.set(i, (Expression) args.get(i).accept(this, arg));
}
removeNulls(args);
}
return n;
}
示例8: visit
import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入方法依赖的package包/类
@Override public void visit(final ExplicitConstructorInvocationStmt n, final Object arg) {
printJavaComment(n.getComment(), arg);
if (n.isThis()) {
printTypeArgs(n.getTypeArgs(), arg);
printer.print("this");
} else {
if (n.getExpr() != null) {
n.getExpr().accept(this, arg);
printer.print(".");
}
printTypeArgs(n.getTypeArgs(), arg);
printer.print("super");
}
printArguments(n.getArgs(), arg);
printer.print(";");
}
示例9: visit
import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入方法依赖的package包/类
@Override
public JCTree visit(final ExplicitConstructorInvocationStmt n, final Object arg) {
//ARG0: List<JCExpression> typeargs
List<JCExpression> arg0 = List.<JCExpression>nil();
if (n.getTypeArgs() != null) {
for (final com.github.javaparser.ast.type.Type t : n.getTypeArgs()) {
arg0 = arg0.append((JCExpression) t.accept(this, arg));
}
}
//ARG1: JCExpression fn
JCExpression arg1;
if (n.isThis()) {
arg1 = new AJCIdent(make.Ident(names.fromString("this")), null);
} else {
if (n.getExpr() != null) {
arg1 = new AJCFieldAccess(make.Select((JCExpression) n.getExpr().accept(this, arg), names.fromString("super")), null);
} else {
arg1 = new AJCIdent(make.Ident(names.fromString("super")), null);
}
}
//ARG2: List<JCExpression> args
List<JCExpression> arg2 = List.<JCExpression>nil();
if (n.getArgs() != null) {
for (final Expression e : n.getArgs()) {
arg2 = arg2.append((JCExpression) e.accept(this, arg));
}
}
// It is expected a Statement, so converting the invocation
return new AJCExpressionStatement(make.Exec(new AJCMethodInvocation(make.Apply(arg0, arg1, arg2), null)), ((n.getComment() != null) ? n.getComment().getContent() : null));
}
示例10: doIsEquals
import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入方法依赖的package包/类
@Override public boolean doIsEquals(ExplicitConstructorInvocationStmt first, ExplicitConstructorInvocationStmt second) {
if(!isEqualsUseMerger(first.getExpr(),second.getExpr())) return false;
if(!isEqualsUseMerger(first.getTypeArgs(),second.getTypeArgs())) return false;
if(!isEqualsUseMerger(first.getArgs(),second.getArgs())) return false;
if(first.isThis() != second.isThis()) return false;
return true;
}
示例11: solve
import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入方法依赖的package包/类
public SymbolReference<ConstructorDeclaration> solve(ExplicitConstructorInvocationStmt explicitConstructorInvocationStmt, boolean solveLambdas) {
List<Type> argumentTypes = new LinkedList<>();
List<LambdaArgumentTypePlaceholder> placeholders = new LinkedList<>();
solveArguments(explicitConstructorInvocationStmt, explicitConstructorInvocationStmt.getArguments(), solveLambdas, argumentTypes, placeholders);
Optional<ClassOrInterfaceDeclaration> optAncestor = explicitConstructorInvocationStmt.getAncestorOfType(ClassOrInterfaceDeclaration.class);
if (!optAncestor.isPresent()) {
return SymbolReference.unsolved(ConstructorDeclaration.class);
}
ClassOrInterfaceDeclaration classNode = optAncestor.get();
TypeDeclaration typeDecl = null;
if (!explicitConstructorInvocationStmt.isThis()) {
Type classDecl = JavaParserFacade.get(typeSolver).convert(classNode.getExtendedTypes(0), classNode);
if (classDecl.isReferenceType()) {
typeDecl = classDecl.asReferenceType().getTypeDeclaration();
}
} else {
SymbolReference<TypeDeclaration> sr = JavaParserFactory.getContext(classNode, typeSolver).solveType(classNode.getNameAsString(), typeSolver);
if (sr.isSolved()) {
typeDecl = sr.getCorrespondingDeclaration();
}
}
if (typeDecl == null) {
return SymbolReference.unsolved(ConstructorDeclaration.class);
}
SymbolReference<ConstructorDeclaration> res = ConstructorResolutionLogic.findMostApplicable(((ClassDeclaration) typeDecl).getConstructors(), argumentTypes, typeSolver);
for (LambdaArgumentTypePlaceholder placeholder : placeholders) {
placeholder.setMethod(res);
}
return res;
}
示例12: solve
import com.github.javaparser.ast.stmt.ExplicitConstructorInvocationStmt; //导入方法依赖的package包/类
public SymbolReference<ResolvedConstructorDeclaration> solve(ExplicitConstructorInvocationStmt explicitConstructorInvocationStmt, boolean solveLambdas) {
List<ResolvedType> argumentTypes = new LinkedList<>();
List<LambdaArgumentTypePlaceholder> placeholders = new LinkedList<>();
solveArguments(explicitConstructorInvocationStmt, explicitConstructorInvocationStmt.getArguments(), solveLambdas, argumentTypes, placeholders);
Optional<ClassOrInterfaceDeclaration> optAncestor = explicitConstructorInvocationStmt.getAncestorOfType(ClassOrInterfaceDeclaration.class);
if (!optAncestor.isPresent()) {
return SymbolReference.unsolved(ResolvedConstructorDeclaration.class);
}
ClassOrInterfaceDeclaration classNode = optAncestor.get();
ResolvedTypeDeclaration typeDecl = null;
if (!explicitConstructorInvocationStmt.isThis()) {
ResolvedType classDecl = JavaParserFacade.get(typeSolver).convert(classNode.getExtendedTypes(0), classNode);
if (classDecl.isReferenceType()) {
typeDecl = classDecl.asReferenceType().getTypeDeclaration();
}
} else {
SymbolReference<ResolvedTypeDeclaration> sr = JavaParserFactory.getContext(classNode, typeSolver).solveType(classNode.getNameAsString(), typeSolver);
if (sr.isSolved()) {
typeDecl = sr.getCorrespondingDeclaration();
}
}
if (typeDecl == null) {
return SymbolReference.unsolved(ResolvedConstructorDeclaration.class);
}
SymbolReference<ResolvedConstructorDeclaration> res = ConstructorResolutionLogic.findMostApplicable(((ResolvedClassDeclaration) typeDecl).getConstructors(), argumentTypes, typeSolver);
for (LambdaArgumentTypePlaceholder placeholder : placeholders) {
placeholder.setMethod(res);
}
return res;
}