org.eclipse.jdt.core.dom.CompilationUnit.types()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(215)

本文整理了Java中org.eclipse.jdt.core.dom.CompilationUnit.types()方法的一些代码示例,展示了CompilationUnit.types()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CompilationUnit.types()方法的具体详情如下:
包路径:org.eclipse.jdt.core.dom.CompilationUnit
类名称:CompilationUnit
方法名:types

CompilationUnit.types介绍

[英]The list of type declarations in textual order order; initially none (elementType: AbstractTypeDeclaration)
[中]按文本顺序排列的类型声明列表;最初无(elementType:AbstractTypeDeclaration

代码示例

代码示例来源:origin: org.projectlombok/lombok

org.eclipse.jdt.core.dom.AbstractTypeDeclaration typeDeclaration = findTypeDeclaration(rootType, cuUnit.types());
while (!typeStack.isEmpty() && typeDeclaration != null) {
  typeDeclaration = findTypeDeclaration(typeStack.pop(), typeDeclaration.bodyDeclarations());

代码示例来源:origin: stackoverflow.com

tp.setName(ast.newSimpleName("X"));
td.typeParameters().add(tp);
cu.types().add(td);

代码示例来源:origin: org.eclipse/org.eclipse.jdt.debug.ui

/**
 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.CompilationUnit)
 */
public boolean visit(CompilationUnit node) {
  // visit only the type declarations
  List types = node.types();
  for (Iterator iter = types.iterator(); iter.hasNext() && !fFound;) {
    ((TypeDeclaration) iter.next()).accept(this);
  }
  return false;
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.debug.ui

/**
 * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.CompilationUnit)
 */
public boolean visit(CompilationUnit node) {
  // visit only the type declarations
  List types = node.types();
  for (Iterator iter = types.iterator(); iter.hasNext() && !fFound;) {
    ((TypeDeclaration) iter.next()).accept(this);
  }
  return false;
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

final List internalGetChildListProperty(ChildListPropertyDescriptor property) {
  if (property == IMPORTS_PROPERTY) {
    return imports();
  }
  if (property == TYPES_PROPERTY) {
    return types();
  }
  // allow default implementation to flag the error
  return super.internalGetChildListProperty(property);
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

private void findHeader() {
  if (this.astRoot instanceof CompilationUnit) {
    CompilationUnit unit = (CompilationUnit) this.astRoot;
    List<TypeDeclaration> types = unit.types();
    ASTNode firstElement = types.isEmpty() ? unit.getPackage() : types.get(0);
    if (firstElement != null) {
      int headerEndIndex = this.tokenManager.firstIndexIn(firstElement, -1);
      this.tokenManager.setHeaderEndIndex(headerEndIndex);
    }
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

private void findHeader() {
  if (this.astRoot instanceof CompilationUnit) {
    CompilationUnit unit = (CompilationUnit) this.astRoot;
    List<TypeDeclaration> types = unit.types();
    ASTNode firstElement = types.isEmpty() ? unit.getPackage() : types.get(0);
    if (firstElement != null) {
      int headerEndIndex = this.tokenManager.firstIndexIn(firstElement, -1);
      this.tokenManager.setHeaderEndIndex(headerEndIndex);
    }
  }
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

@Override
final List internalGetChildListProperty(ChildListPropertyDescriptor property) {
  if (property == IMPORTS_PROPERTY) {
    return imports();
  }
  if (property == TYPES_PROPERTY) {
    return types();
  }
  // allow default implementation to flag the error
  return super.internalGetChildListProperty(property);
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

final List internalGetChildListProperty(ChildListPropertyDescriptor property) {
  if (property == IMPORTS_PROPERTY) {
    return imports();
  }
  if (property == TYPES_PROPERTY) {
    return types();
  }
  // allow default implementation to flag the error
  return super.internalGetChildListProperty(property);
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

final List internalGetChildListProperty(ChildListPropertyDescriptor property) {
  if (property == IMPORTS_PROPERTY) {
    return imports();
  }
  if (property == TYPES_PROPERTY) {
    return types();
  }
  // allow default implementation to flag the error
  return super.internalGetChildListProperty(property);
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

private void findHeader() {
  if (this.astRoot instanceof CompilationUnit) {
    CompilationUnit unit = (CompilationUnit) this.astRoot;
    List<TypeDeclaration> types = unit.types();
    ASTNode firstElement = types.isEmpty() ? unit.getPackage() : types.get(0);
    if (firstElement != null) {
      int headerEndIndex = this.tokenManager.firstIndexIn(firstElement, -1);
      this.tokenManager.setHeaderEndIndex(headerEndIndex);
    }
  }
}

代码示例来源:origin: org.onehippo.cms7.essentials/hippo-essentials-plugin-api-implementation

/**
 * Returns name of the class, e.g. {@code FooBarBean}
 *
 * @param path path to java source file
 */
public static String getClassName(final Path path) {
  final CompilationUnit unit = getCompilationUnit(path);
  unit.recordModifications();
  final TypeDeclaration classType = (TypeDeclaration) unit.types().get(0);
  return classType.getName().getIdentifier();
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

@Override
public boolean visit(org.eclipse.jdt.core.dom.CompilationUnit compilationUnit) {
  if (checkMalformedNodes(compilationUnit)) {
    return true; // abort sorting of current element
  }
  sortElements(compilationUnit.types(), rewriter.getListRewrite(compilationUnit, org.eclipse.jdt.core.dom.CompilationUnit.TYPES_PROPERTY));
  return true;
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

public boolean visit(org.eclipse.jdt.core.dom.CompilationUnit compilationUnit) {
  if (checkMalformedNodes(compilationUnit)) {
    return true; // abort sorting of current element
  }
  sortElements(compilationUnit.types(), rewriter.getListRewrite(compilationUnit, org.eclipse.jdt.core.dom.CompilationUnit.TYPES_PROPERTY));
  return true;
}

代码示例来源:origin: org.onehippo.cms7.essentials.sdk/implementation

public static String getSupertype(final Path path) {
  final CompilationUnit unit = getCompilationUnit(path);
  unit.recordModifications();
  final TypeDeclaration classType = (TypeDeclaration) unit.types().get(0);
  return classType.getSuperclassType().toString();
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

public boolean visit(org.eclipse.jdt.core.dom.CompilationUnit compilationUnit) {
  if (checkMalformedNodes(compilationUnit)) {
    return true; // abort sorting of current element
  }
  sortElements(compilationUnit.types(), rewriter.getListRewrite(compilationUnit, org.eclipse.jdt.core.dom.CompilationUnit.TYPES_PROPERTY));
  return true;
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

@Override
public void endVisit(CompilationUnit node) {
  if (skipNode(node)) {
    return;
  }
  GenericSequentialFlowInfo info = processSequential(node, node.imports());
  process(info, node.types());
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

@Override
public void endVisit(CompilationUnit node) {
  if (skipNode(node))
    return;
  GenericSequentialFlowInfo info= processSequential(node, node.imports());
  process(info, node.types());
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
public void endVisit(CompilationUnit node) {
  if (skipNode(node))
    return;
  GenericSequentialFlowInfo info= processSequential(node, node.imports());
  process(info, node.types());
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

ASTNode clone0(AST target) {
  CompilationUnit result = new CompilationUnit(target);
  // n.b do not copy line number table or messages
  result.setSourceRange(getStartPosition(), getLength());
  result.setPackage(
    (PackageDeclaration) ASTNode.copySubtree(target, getPackage()));
  result.imports().addAll(ASTNode.copySubtrees(target, imports()));
  result.types().addAll(ASTNode.copySubtrees(target, types()));
  return result;
}

相关文章

微信公众号

最新文章

更多