下面列出了org.eclipse.jdt.core.dom.SuperConstructorInvocation#getExpression ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private SuperConstructorInv visit(SuperConstructorInvocation node) {
int startLine = _cunit.getLineNumber(node.getStartPosition());
int endLine = _cunit.getLineNumber(node.getStartPosition() + node.getLength());
SuperConstructorInv superConstructorInv = new SuperConstructorInv(startLine, endLine, node);
if(node.getExpression() != null){
Expr expression = (Expr) process(node.getExpression());
expression.setParent(superConstructorInv);
superConstructorInv.setExpression(expression);
}
List<Expr> arguments = new ArrayList<>();
for(Object object : node.arguments()){
Expr arg = (Expr) process((ASTNode) object);
arg.setParent(superConstructorInv);
arguments.add(arg);
}
superConstructorInv.setArguments(arguments);
return superConstructorInv;
}
@Override
public boolean visit(final SuperConstructorInvocation node) {
Expression _expression = node.getExpression();
boolean _tripleNotEquals = (_expression != null);
if (_tripleNotEquals) {
node.getExpression().accept(this);
this.appendToBuffer(".");
}
boolean _isEmpty = node.typeArguments().isEmpty();
boolean _not = (!_isEmpty);
if (_not) {
this.appendTypeParameters(node.typeArguments());
}
this.appendToBuffer("super(");
this.visitAllSeparatedByComma(node.arguments());
this.appendToBuffer(")");
return false;
}
public boolean visit(SuperConstructorInvocation stmnt){
/*
* [ Expression . ]
[ < Type { , Type } > ]
super ( [ Expression { , Expression } ] ) ;
*/
if (stmnt.getExpression() != null){
handleExpression((Expression) stmnt.getExpression());
appendPeriod();
}
handleTypeArguments(stmnt.typeArguments());
styledString.append("super", new StyledStringStyler(keywordStyle));
handleParameters(stmnt.arguments());
appendSemicolon();
return false;
}
public OperationInvocation(CompilationUnit cu, String filePath, SuperConstructorInvocation invocation) {
this.locationInfo = new LocationInfo(cu, filePath, invocation, CodeElementType.SUPER_CONSTRUCTOR_INVOCATION);
this.methodName = "super";
this.typeArguments = invocation.arguments().size();
this.arguments = new ArrayList<String>();
List<Expression> args = invocation.arguments();
for(Expression argument : args) {
this.arguments.add(argument.toString());
}
if(invocation.getExpression() != null) {
this.expression = invocation.getExpression().toString();
processExpression(invocation.getExpression(), this.subExpressions);
}
}
private void updateConstructorReference(final SuperConstructorInvocation invocation, final CompilationUnitRewrite targetRewrite, final ICompilationUnit unit, TextEditGroup group) throws CoreException {
Assert.isNotNull(invocation);
Assert.isNotNull(targetRewrite);
Assert.isNotNull(unit);
final ASTRewrite rewrite= targetRewrite.getASTRewrite();
if (fCreateInstanceField)
insertExpressionAsParameter(invocation, rewrite, unit, group);
final Expression expression= invocation.getExpression();
if (expression != null) {
rewrite.remove(expression, null);
targetRewrite.getImportRemover().registerRemovedNode(expression);
}
}