List of usage examples for org.eclipse.jdt.core.dom SingleVariableDeclaration varargsAnnotations
ASTNode.NodeList varargsAnnotations
To view the source code for org.eclipse.jdt.core.dom SingleVariableDeclaration varargsAnnotations.
Click Source Link
From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java
License:Open Source License
@Override public boolean visit(SingleVariableDeclaration node) { if (node.getAST().apiLevel() >= JLS3) { printModifiers(node.modifiers()); }//from ww w . j a v a2s. c om node.getType().accept(this); if (node.getAST().apiLevel() >= JLS3) { if (node.isVarargs()) { if (node.getAST().apiLevel() >= AST.JLS8) { this.fBuffer.append(' '); List<Annotation> annotations = node.varargsAnnotations(); printAnnotationsList(annotations); } this.fBuffer.append("...");//$NON-NLS-1$ } } this.fBuffer.append(" ");//$NON-NLS-1$ node.getName().accept(this); if (node.getAST().apiLevel() >= AST.JLS8) { List<Dimension> dimensions = node.extraDimensions(); for (Iterator<Dimension> it = dimensions.iterator(); it.hasNext();) { Dimension e = it.next(); e.accept(this); } } else { for (int i = 0; i < node.getExtraDimensions(); i++) { this.fBuffer.append("[]"); //$NON-NLS-1$ } } if (node.getInitializer() != null) { this.fBuffer.append("=");//$NON-NLS-1$ node.getInitializer().accept(this); } return false; }
From source file:com.bsiag.eclipse.jdt.java.formatter.SpacePreparator.java
License:Open Source License
@Override public void endVisit(SingleVariableDeclaration node) { // this must be endVisit in case a space added by a visit on a child node needs to be cleared if (node.isVarargs()) { handleTokenBefore(node.getName(), TokenNameELLIPSIS, this.options.insert_space_before_ellipsis, this.options.insert_space_after_ellipsis); List<Annotation> varargsAnnotations = node.varargsAnnotations(); if (!varargsAnnotations.isEmpty()) { this.tm.firstTokenIn(varargsAnnotations.get(0), TokenNameAT).spaceBefore(); this.tm.lastTokenIn(varargsAnnotations.get(varargsAnnotations.size() - 1), -1).clearSpaceAfter(); }/*from ww w . ja v a 2s .c om*/ } else { handleToken(node.getName(), TokenNameIdentifier, true, false); } }
From source file:com.google.googlejavaformat.java.JavaInputAstVisitor.java
License:Apache License
/** * Helper method for {@link EnhancedForStatement}s, {@link MethodDeclaration}s, and * {@link SingleVariableDeclaration}s.//from w w w. j a va 2s .co m */ private void visitToDeclare(Direction annotationsDirection, SingleVariableDeclaration node, Optional<Expression> initializer, String equals) { sync(node); declareOne(node, annotationsDirection, node.modifiers(), node.getType(), VarArgsOrNot.valueOf(node.isVarargs()), node.varargsAnnotations(), node.getName(), "", node.extraDimensions(), equals, initializer, Optional.<String>absent(), ReceiverParameter.NO); }
From source file:org.codemucker.jmutate.ast.JAstFlattener.java
License:Open Source License
public boolean visit(SingleVariableDeclaration node) { printIndent();/* w w w . j ava 2 s. co m*/ if (node.getAST().apiLevel() == JLS2) { printModifiers(node.getModifiers()); } if (node.getAST().apiLevel() >= JLS3) { printModifiers(node.modifiers()); } node.getType().accept(this); if (node.getAST().apiLevel() >= JLS3) { if (node.isVarargs()) { if (node.getAST().apiLevel() >= AST.JLS8) { List annotations = node.varargsAnnotations(); if (annotations.size() > 0) { this.buffer.append(' '); } visitAnnotationsList(annotations); } this.buffer.append("...");//$NON-NLS-1$ } } this.buffer.append(" ");//$NON-NLS-1$ node.getName().accept(this); int size = node.getExtraDimensions(); if (node.getAST().apiLevel() >= AST.JLS8) { List dimensions = node.extraDimensions(); for (int i = 0; i < size; i++) { visit((Dimension) dimensions.get(i)); } } else { for (int i = 0; i < size; i++) { this.buffer.append("[]"); //$NON-NLS-1$ } } if (node.getInitializer() != null) { this.buffer.append("=");//$NON-NLS-1$ node.getInitializer().accept(this); } return false; }
From source file:org.whole.lang.java.util.JDTTransformerVisitor.java
License:Open Source License
public boolean visit(SingleVariableDeclaration node) { varDecl = lf.create(JavaEntityDescriptorEnum.SingleVariableDeclaration); if (params != null) params.wAdd(varDecl);//www . j ava 2s. c o m List<?> modifiers = node.modifiers(); if (!modifiers.isEmpty()) { varDecl.setModifiers(lf.create(JavaEntityDescriptorEnum.ExtendedModifiers)); setExtendedModifiers(varDecl.getModifiers(), modifiers); } if (acceptChild(node.getType())) varDecl.setType(type); varDecl.setVarargs(lf.createVarargs(node.isVarargs())); setAnnotations(varDecl.getVarargsAnnotations(), (List<?>) node.varargsAnnotations()); varDecl.getExtraDimensions().wSetValue(node.getExtraDimensions()); if (acceptChild(node.getInitializer())) varDecl.setInitializer(exp); if (acceptChild(node.getName())) varDecl.setName((org.whole.lang.java.model.SimpleName) name); return false; }