本文整理匯總了Java中org.eclipse.jdt.core.dom.TypeDeclaration.getTypes方法的典型用法代碼示例。如果您正苦於以下問題:Java TypeDeclaration.getTypes方法的具體用法?Java TypeDeclaration.getTypes怎麽用?Java TypeDeclaration.getTypes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jdt.core.dom.TypeDeclaration
的用法示例。
在下文中一共展示了TypeDeclaration.getTypes方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: populateMethodDeclarations
import org.eclipse.jdt.core.dom.TypeDeclaration; //導入方法依賴的package包/類
private void populateMethodDeclarations(TypeDeclaration declaration){
TypeDeclaration[] nestedTypes = declaration.getTypes();
for (int i = 0; i < nestedTypes.length; i++) {
TypeDeclaration nestedType = nestedTypes[i];
populateMethodDeclarations(nestedType);
}
FieldDeclaration[] fields = declaration.getFields();
for (FieldDeclaration fieldDeclaration : fields) {
fieldDeclaration.accept(new HeuristicOwnedVisitor());
}
MethodDeclaration[] methods = declaration.getMethods();
for (MethodDeclaration methodDeclaration : methods) {
methodDeclaration.accept(new HeuristicOwnedVisitor());
methodDeclaration.accept(new HeuristicOwnedLocalsVisitor());
this.methodDecls.add(methodDeclaration);
}
}
示例2: populateMethodDeclarations
import org.eclipse.jdt.core.dom.TypeDeclaration; //導入方法依賴的package包/類
private void populateMethodDeclarations(TypeDeclaration declaration){
TypeDeclaration[] nestedTypes = declaration.getTypes();
for (int i = 0; i < nestedTypes.length; i++) {
TypeDeclaration nestedType = nestedTypes[i];
populateMethodDeclarations(nestedType);
}
FieldDeclaration[] fields = declaration.getFields();
// for (FieldDeclaration fieldDeclaration : fields) {
// fieldDeclaration.accept(new HeuristicOwnedVisitor());
// }
MethodDeclaration[] methods = declaration.getMethods();
for (MethodDeclaration methodDeclaration : methods) {
// methodDeclaration.accept(new HeuristicOwnedVisitor());
// methodDeclaration.accept(new HeuristicOwnedLocalsVisitor());
this.methodDecls.add(methodDeclaration);
}
}
示例3: recursivelyFindClassByName
import org.eclipse.jdt.core.dom.TypeDeclaration; //導入方法依賴的package包/類
private TypeDeclaration recursivelyFindClassByName(TypeDeclaration currentTypeDeclaration, String className) {
if (currentTypeDeclaration.getName().toString().equals(className)) {
return currentTypeDeclaration;
} else {
for (TypeDeclaration type : currentTypeDeclaration.getTypes()) {
TypeDeclaration result = recursivelyFindClassByName(type, className);
if (result != null) {
return result;
}
}
return null;
}
}
示例4: isTypeLooksLikeABuilder
import org.eclipse.jdt.core.dom.TypeDeclaration; //導入方法依賴的package包/類
private boolean isTypeLooksLikeABuilder(TypeDeclaration nestedType) {
if (nestedType.getTypes().length > 0) {
return false;
}
if (nestedType.getMethods().length < 2) {
return false;
}
if (getNumberOfEmptyPrivateConstructors(nestedType) != 1) {
return false;
}
return true;
}
示例5: traverseType
import org.eclipse.jdt.core.dom.TypeDeclaration; //導入方法依賴的package包/類
private void traverseType(TypeDeclaration declaration) throws IOException {
TypeDeclaration[] nestedTypes = declaration.getTypes();
for (int i = 0; i < nestedTypes.length; i++) {
traverseType(nestedTypes[i]);
}
traverseTypeDecl(declaration);
}
示例6: traverseType
import org.eclipse.jdt.core.dom.TypeDeclaration; //導入方法依賴的package包/類
private void traverseType(TypeDeclaration declaration, boolean takesParams) {
// Add default mapping to model
String typeName = null;
ITypeBinding tb = declaration.resolveBinding();
if (Config.USE_QUALIFIED_TYPENAME) {
typeName = tb.getQualifiedName();
}
else {
typeName = declaration.getName().toString();
}
// Add the interfaces and the classes without superClass to the map
// file.
// HACK: This is a very bad idea. The tool does not generate
// @DomainParams for classes that inherit from a
// built-in type! Fix it!
// This is an example of a premature optimization (minimizing the size
// of the map) gone bad. The focus should be
// on correctness first.
if (!model.hasMapping(typeName) && getAllSuperTypes(declaration).size() == 0) {
model.addMapping(new Entry(typeName));
}
List<Type> allSuperTypes = getAllSuperTypes(declaration);
for (Type type : allSuperTypes) {
ITypeBinding stb = type.resolveBinding();
String superTypeName = stb.getQualifiedName();
if (!model.hasMapping(superTypeName)) {
model.addMapping(new Entry(superTypeName));
}
}
TypeDeclaration[] nestedTypes = declaration.getTypes();
for (int i = 0; i < nestedTypes.length; i++) {
TypeDeclaration nestedType = nestedTypes[i];
traverseType(nestedType, false);
}
}
示例7: traverseType
import org.eclipse.jdt.core.dom.TypeDeclaration; //導入方法依賴的package包/類
private void traverseType(TypeDeclaration declaration) throws IOException {
TypeDeclaration[] nestedTypes = declaration.getTypes();
for (int i = 0; i < nestedTypes.length; i++) {
traverseType(nestedTypes[i]);
}
traverseTypeDecl(declaration);
traverseMethod(declaration);
traverseFields(declaration);
}
示例8: traverseType
import org.eclipse.jdt.core.dom.TypeDeclaration; //導入方法依賴的package包/類
private void traverseType(ASTRewrite rewrite, TypeDeclaration declaration) {
TypeDeclaration[] nestedTypes = declaration.getTypes();
for (int i = 0; i < nestedTypes.length; i++) {
TypeDeclaration nestedType = nestedTypes[i];
traverseType(rewrite, nestedType);
}
ASTNode domainInheritsNode = hasTypeAnnotation(declaration.modifiers(), "DomainInherits");
if (domainInheritsNode == null) {
setTypeAnnotationInherits(rewrite, declaration, "DomainInherits", "p", null);
}
else {
updateTypeAnnotationInherits(rewrite, declaration, "DomainInherits", "p", domainInheritsNode);
}
ASTNode domainsNode = hasTypeAnnotation(declaration.modifiers(), "Domains");
// XXX. do not generate @Domains annotations on interfaces!
// if (!declaration.isInterface()) {
if ( domainsNode == null ) {
setTypeAnnotationDomains(rewrite, declaration, "Domains", "owned", null);
}
else {
updateTypeAnnotationDomains(rewrite, declaration, "Domains", "owned", null, domainsNode);
}
// }
if (!declaration.resolveBinding().getQualifiedName().equals(Config.MAINCLASS)) {
ASTNode domainParamsNode = hasTypeAnnotation(declaration.modifiers(), "DomainParams");
if (domainParamsNode == null) {
setTypeAnnotationParams(rewrite, declaration, "DomainParams", "p", domainsNode);
}
else {
updateTypeAnnotationParams(rewrite, declaration, "DomainParams", "p", domainsNode, domainParamsNode);
}
}
/*if (!declaration.resolveBinding().getQualifiedName().equals(Config.MAINCLASS)) {
ASTNode domainAssumesNode = hasTypeAnnotation(declaration.modifiers(), "DomainAssumes");
if (domainAssumesNode == null) {
setTypeAnnotationDomainAssumes(rewrite, declaration, "DomainAssumes", "owner->p", null);
}
else {
updateTypeAnnotationDomainAssumes(rewrite, declaration, "DomainAssumes", "owner->p", null, domainAssumesNode);
}
}
else{
ASTNode domainAssumesNode = hasTypeAnnotation(declaration.modifiers(), "DomainAssumes");
if (domainAssumesNode == null) {
setTypeAnnotationDomainAssumes(rewrite, declaration, "DomainAssumes", "owner->owner", null);
}
else {
updateTypeAnnotationDomainAssumes(rewrite, declaration, "DomainAssumes", "owner->owner", null, domainAssumesNode);
}
}*/
annotateMethods(rewrite, declaration);
annotateFieldDeclarations(rewrite, declaration);
}