List of usage examples for org.eclipse.jdt.core.dom VariableDeclaration getLength
public final int getLength()
From source file:br.uff.ic.gems.resources.ast.Visitor.java
public boolean visit(VariableDeclaration node) { int beginLine = cu.getLineNumber(node.getStartPosition()); int endLine = cu.getLineNumber(node.getStartPosition() + node.getLength()); int beginColumn = cu.getColumnNumber(node.getStartPosition()); int endColumn = cu.getColumnNumber(node.getStartPosition() + node.getLength()); languageConstructs.add(/* w ww.j a v a 2 s . c o m*/ new LanguageConstruct(node.getClass().getSimpleName(), beginLine, endLine, beginColumn, endColumn)); return true; }
From source file:org.jboss.tools.ws.jaxrs.core.jdt.SourceType.java
License:Open Source License
/** * Factory method for the {@link SourceType} * @param declaration the {@link VariableDeclaration} * @return the {@link SourceType}/*w w w. jav a 2 s .co m*/ */ public static SourceType from(final VariableDeclaration declaration) { final IVariableBinding paramBinding = declaration.resolveBinding(); if (paramBinding != null) { final String erasureName = paramBinding.getType().getErasure().getQualifiedName(); final IType erasureType = (IType) paramBinding.getType().getErasure().getJavaElement(); final List<IType> typeArguments = new ArrayList<IType>(); final ISourceRange nameRange = new SourceRange(declaration.getStartPosition(), declaration.getLength()); for (ITypeBinding typeArgumentBinding : paramBinding.getType().getTypeArguments()) { typeArguments.add((IType) typeArgumentBinding.getJavaElement()); } return new SourceType(erasureName, erasureType, typeArguments, paramBinding.getType().isPrimitive(), nameRange); } return null; }