@Override protected void changeParamgumentType(ParameterInfo info) { if (!(fNode instanceof MethodRef)) return; MethodRefParameter oldParam = (MethodRefParameter) ((MethodRef) fNode).parameters().get(info.getOldIndex()); Type oldTypeNode = oldParam.getType(); Type newTypeNode = createNewDocRefType(info); if (info.isNewVarargs()) { if (info.isOldVarargs() && !oldParam.isVarargs()) { // leave as array reference if old reference was not vararg newTypeNode = ASTNodeFactory.newArrayType(newTypeNode); } else { getASTRewrite() .set(oldParam, MethodRefParameter.VARARGS_PROPERTY, Boolean.TRUE, fDescription); } } else { if (oldParam.isVarargs()) { getASTRewrite() .set(oldParam, MethodRefParameter.VARARGS_PROPERTY, Boolean.FALSE, fDescription); } } getASTRewrite().replace(oldTypeNode, newTypeNode, fDescription); registerImportRemoveNode(oldTypeNode); }
@Override protected void changeParamgumentType(ParameterInfo info) { if (! (fNode instanceof MethodRef)) return; MethodRefParameter oldParam= (MethodRefParameter) ((MethodRef) fNode).parameters().get(info.getOldIndex()); Type oldTypeNode= oldParam.getType(); Type newTypeNode= createNewDocRefType(info); if (info.isNewVarargs()) { if (info.isOldVarargs() && ! oldParam.isVarargs()) { // leave as array reference if old reference was not vararg newTypeNode= ASTNodeFactory.newArrayType(newTypeNode); } else { getASTRewrite().set(oldParam, MethodRefParameter.VARARGS_PROPERTY, Boolean.TRUE, fDescription); } } else { if (oldParam.isVarargs()) { getASTRewrite().set(oldParam, MethodRefParameter.VARARGS_PROPERTY, Boolean.FALSE, fDescription); } } getASTRewrite().replace(oldTypeNode, newTypeNode, fDescription); registerImportRemoveNode(oldTypeNode); }
@SuppressWarnings("unchecked") private void createArguments(final MethodDeclaration declaration, final List<? extends ASTNode> arguments, boolean methodInvocation) { Assert.isNotNull(declaration); Assert.isNotNull(arguments); SingleVariableDeclaration variable= null; final int size= declaration.parameters().size(); for (int index= 0; index < size; index++) { variable= (SingleVariableDeclaration) declaration.parameters().get(index); if (methodInvocation) { // we are creating method invocation parameters final SimpleName expression= getAst().newSimpleName(variable.getName().getIdentifier()); ((List<Expression>) arguments).add(expression); } else { // we are creating type info for the javadoc final MethodRefParameter parameter= getAst().newMethodRefParameter(); parameter.setType(ASTNodeFactory.newType(getAst(), variable)); if ((index == size - 1) && declaration.isVarargs()) parameter.setVarargs(true); ((List<MethodRefParameter>) arguments).add(parameter); } } }
@Override protected void changeParamgumentType(ParameterInfo info) { if (! (fNode instanceof MethodRef)) return; MethodRefParameter oldParam= (MethodRefParameter) ((MethodRef) fNode).parameters().get(info.getOldIndex()); Type oldTypeNode= oldParam.getType(); Type newTypeNode= createNewDocRefType(info); if (info.isNewVarargs()) { if (info.isOldVarargs() && ! oldParam.isVarargs()) { // leave as array reference of old reference was not vararg newTypeNode= getASTRewrite().getAST().newArrayType(newTypeNode); } else { getASTRewrite().set(oldParam, MethodRefParameter.VARARGS_PROPERTY, Boolean.TRUE, fDescription); } } else { if (oldParam.isVarargs()) { getASTRewrite().set(oldParam, MethodRefParameter.VARARGS_PROPERTY, Boolean.FALSE, fDescription); } } getASTRewrite().replace(oldTypeNode, newTypeNode, fDescription); registerImportRemoveNode(oldTypeNode); }
@Override public boolean visit(MethodRef node) { if (node.getQualifier() != null) { node.getQualifier().accept(this); } this.fBuffer.append("#");//$NON-NLS-1$ node.getName().accept(this); this.fBuffer.append("(");//$NON-NLS-1$ for (Iterator<MethodRefParameter> it= node.parameters().iterator(); it.hasNext();) { MethodRefParameter e= it.next(); e.accept(this); if (it.hasNext()) { this.fBuffer.append(",");//$NON-NLS-1$ } } this.fBuffer.append(")");//$NON-NLS-1$ return false; }
public boolean visit(MethodRef node) { if (node.getQualifier() != null) { node.getQualifier().accept(this); } this.buffer.append("#");//$NON-NLS-1$ node.getName().accept(this); this.buffer.append("(");//$NON-NLS-1$ for (Iterator it = node.parameters().iterator(); it.hasNext(); ) { MethodRefParameter e = (MethodRefParameter) it.next(); e.accept(this); if (it.hasNext()) { this.buffer.append(",");//$NON-NLS-1$ } } this.buffer.append(")");//$NON-NLS-1$ return false; }
@Override public boolean visit(MethodRef node) { Name qualifier= node.getQualifier(); if (qualifier != null) { typeRefFound(qualifier); } List<MethodRefParameter> list= node.parameters(); if (list != null) { doVisitChildren(list); // visit MethodRefParameter with Type } return false; }
@Override public boolean visit(MethodRef node) { Name qualifier = node.getQualifier(); if (qualifier != null) { typeRefFound(qualifier); } List<MethodRefParameter> list = node.parameters(); if (list != null) { doVisitChildren(list); // visit MethodRefParameter with Type } return false; }
private MethodRefParameter createNewMethodRefParameter(ParameterInfo info) { MethodRefParameter newP = getASTRewrite().getAST().newMethodRefParameter(); // only add name iff first parameter already has a name: List<? extends ASTNode> parameters = getParamgumentsRewrite().getOriginalList(); if (parameters.size() > 0) if (((MethodRefParameter) parameters.get(0)).getName() != null) newP.setName(getASTRewrite().getAST().newSimpleName(info.getNewName())); newP.setType(createNewDocRefType(info)); newP.setVarargs(info.isNewVarargs()); return newP; }
@Override protected void changeParamgumentName(ParameterInfo info) { if (!(fNode instanceof MethodRef)) return; MethodRefParameter oldParam = (MethodRefParameter) ((MethodRef) fNode).parameters().get(info.getOldIndex()); SimpleName oldParamName = oldParam.getName(); if (oldParamName != null) getASTRewrite() .set(oldParamName, SimpleName.IDENTIFIER_PROPERTY, info.getNewName(), fDescription); }
private MethodRefParameter createNewMethodRefParameter(ParameterInfo info) { MethodRefParameter newP= getASTRewrite().getAST().newMethodRefParameter(); // only add name iff first parameter already has a name: List<? extends ASTNode> parameters= getParamgumentsRewrite().getOriginalList(); if (parameters.size() > 0) if (((MethodRefParameter) parameters.get(0)).getName() != null) newP.setName(getASTRewrite().getAST().newSimpleName(info.getNewName())); newP.setType(createNewDocRefType(info)); newP.setVarargs(info.isNewVarargs()); return newP; }
@Override protected void changeParamgumentName(ParameterInfo info) { if (! (fNode instanceof MethodRef)) return; MethodRefParameter oldParam= (MethodRefParameter) ((MethodRef) fNode).parameters().get(info.getOldIndex()); SimpleName oldParamName= oldParam.getName(); if (oldParamName != null) getASTRewrite().set(oldParamName, SimpleName.IDENTIFIER_PROPERTY, info.getNewName(), fDescription); }
@Override public boolean visit(MethodRefParameter node) { node.getType().accept(this); if (node.getAST().apiLevel() >= JLS3) { if (node.isVarargs()) { this.fBuffer.append("...");//$NON-NLS-1$ } } if (node.getName() != null) { this.fBuffer.append(" ");//$NON-NLS-1$ node.getName().accept(this); } return false; }
public boolean visit(MethodRefParameter node) { node.getType().accept(this); if (node.getAST().apiLevel() >= JLS3) { if (node.isVarargs()) { this.buffer.append("...");//$NON-NLS-1$ } } if (node.getName() != null) { this.buffer.append(" ");//$NON-NLS-1$ node.getName().accept(this); } return false; }
@Override public boolean visit(MethodRefParameter node) { doVisitNode(node.getType()); return false; }
@Override protected MethodRefParameter createNewParamgument( ParameterInfo info, List<ParameterInfo> parameterInfos, List<MethodRefParameter> nodes) { return createNewMethodRefParameter(info); }
/** {@inheritDoc} */ @Override public void endVisit(MethodRefParameter node) { logger.warn("Method endVisitMethodRefParameter for " + node + " for " + node + " not implemented!"); super.endVisit(node); }
/** {@inheritDoc} */ @Override public boolean visit(MethodRefParameter node) { logger.warn("Method visitMethodRefParameter for " + node + " not implemented!"); return super.visit(node); }
@Override public boolean visit(final MethodRefParameter node) { return false; }
@Override public boolean visit(final MethodRefParameter node) { // will never be visited assert false; return false; }
@Override protected MethodRefParameter createNewParamgument(ParameterInfo info, List<ParameterInfo> parameterInfos, List<MethodRefParameter> nodes) { return createNewMethodRefParameter(info); }
@Override public boolean visit(MethodRefParameter node) { if (node.subtreeMatch(fMatcher, fNodeToMatch)) return matches(node); return super.visit(node); }
@Override public void endVisit(MethodRefParameter node) { endVisitNode(node); }
@Override public boolean visit(MethodRefParameter node) { return visitNode(node); }
@Override public boolean visit(MethodRefParameter node) { return visit((ASTNode)node); }
@Override public void endVisit(MethodRefParameter node) { endVisit((ASTNode)node); }
@Override public boolean visit(final MethodRefParameter node) { return this.internalVisit(node); }
@Override public boolean visit(MethodRefParameter node) { System.out.println("Found: " + node.getClass()); return super.visit(node); }