Java Code Examples for org.eclipse.jdt.core.dom.TypeDeclaration#superInterfaceTypes()
The following examples show how to use
org.eclipse.jdt.core.dom.TypeDeclaration#superInterfaceTypes() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UiBinderJavaValidator.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
@SuppressWarnings("unchecked") private static ITypeBinding getOwnerTypeBinding( TypeDeclaration uiBinderSubtype) { List<Type> superInterfaces = uiBinderSubtype.superInterfaceTypes(); for (Type superInterface : superInterfaces) { ITypeBinding binding = superInterface.resolveBinding(); if (binding != null) { if (binding.getErasure().getQualifiedName().equals( UiBinderConstants.UI_BINDER_TYPE_NAME)) { if (superInterface instanceof ParameterizedType) { ParameterizedType uiBinderType = (ParameterizedType) superInterface; List<Type> typeArgs = uiBinderType.typeArguments(); if (typeArgs.size() == 2) { Type ownerType = typeArgs.get(1); return ownerType.resolveBinding(); } } } } } return null; }
Example 2
Source File: TypeParseVisitor.java From SimFix with GNU General Public License v2.0 | 5 votes |
public boolean visit(TypeDeclaration node) { Pair<String, String> clazzAndMethodName = NodeUtils.getTypeDecAndMethodDec(node.getName()); String clazz = clazzAndMethodName.getFirst(); AST ast = AST.newAST(AST.JLS8); Type type = ast.newSimpleType(ast.newSimpleName(clazz)); ProjectInfo.addFieldType(clazz, "THIS", type); Type suType = node.getSuperclassType(); if(suType != null){ ProjectInfo.addFieldType(clazz, "SUPER", suType); ProjectInfo.addSuperClass(clazz, suType.toString()); } List<Object> sInterfaces = node.superInterfaceTypes(); if(sInterfaces != null){ for(Object object : sInterfaces){ if(object instanceof Type){ Type interfaceType = (Type) object; ProjectInfo.addSuperInterface(clazz, interfaceType.toString()); } } } FieldDeclaration fields[] = node.getFields(); for (FieldDeclaration f : fields) { for (Object o : f.fragments()) { VariableDeclarationFragment vdf = (VariableDeclarationFragment) o; Type tmpType = f.getType(); if(vdf.getExtraDimensions() > 0){ tmpType = ast.newArrayType((Type) ASTNode.copySubtree(ast, tmpType), vdf.getExtraDimensions()); } ProjectInfo.addFieldType(clazz, vdf.getName().toString(), tmpType); } } return true; }
Example 3
Source File: JavaASTVisitor.java From SnowGraph with Apache License 2.0 | 5 votes |
private boolean visitInterface(TypeDeclaration node) { InterfaceInfo interfaceInfo = new InterfaceInfo(); interfaceInfo.name = node.getName().getFullyQualifiedName(); interfaceInfo.fullName = NameResolver.getFullName(node); interfaceInfo.visibility = getVisibility(node); List<Type> superInterfaceList = node.superInterfaceTypes(); for (Type superInterface : superInterfaceList) interfaceInfo.superInterfaceTypeList.add(NameResolver.getFullName(superInterface)); if (node.getJavadoc() != null) interfaceInfo.comment = sourceContent.substring(node.getJavadoc().getStartPosition(), node.getJavadoc().getStartPosition() + node.getJavadoc().getLength()); interfaceInfo.content = sourceContent.substring(node.getStartPosition(), node.getStartPosition() + node.getLength()); elementInfoPool.interfaceInfoMap.put(interfaceInfo.fullName, interfaceInfo); MethodDeclaration[] methodDeclarations = node.getMethods(); for (MethodDeclaration methodDeclaration : methodDeclarations) { MethodInfo methodInfo = createMethodInfo(methodDeclaration, interfaceInfo.fullName); elementInfoPool.methodInfoMap.put(methodInfo.hashName(), methodInfo); } FieldDeclaration[] fieldDeclarations = node.getFields(); for (FieldDeclaration fieldDeclaration : fieldDeclarations) { List<FieldInfo> fieldInfos = createFieldInfos(fieldDeclaration, interfaceInfo.fullName); for (FieldInfo fieldInfo : fieldInfos) elementInfoPool.fieldInfoMap.put(fieldInfo.hashName(), fieldInfo); } return true; }
Example 4
Source File: JavaASTVisitor.java From SnowGraph with Apache License 2.0 | 5 votes |
private boolean visitClass(TypeDeclaration node) { ClassInfo classInfo = new ClassInfo(); classInfo.name = node.getName().getFullyQualifiedName(); classInfo.fullName = NameResolver.getFullName(node); classInfo.visibility = getVisibility(node); classInfo.isAbstract = isAbstract(node); classInfo.isFinal = isFinal(node); classInfo.superClassType = node.getSuperclassType() == null ? "java.lang.Object" : NameResolver.getFullName(node.getSuperclassType()); List<Type> superInterfaceList = node.superInterfaceTypes(); for (Type superInterface : superInterfaceList) classInfo.superInterfaceTypeList.add(NameResolver.getFullName(superInterface)); if (node.getJavadoc() != null) classInfo.comment = sourceContent.substring(node.getJavadoc().getStartPosition(), node.getJavadoc().getStartPosition() + node.getJavadoc().getLength()); classInfo.content = sourceContent.substring(node.getStartPosition(), node.getStartPosition() + node.getLength()); elementInfoPool.classInfoMap.put(classInfo.fullName, classInfo); MethodDeclaration[] methodDeclarations = node.getMethods(); for (MethodDeclaration methodDeclaration : methodDeclarations) { MethodInfo methodInfo = createMethodInfo(methodDeclaration, classInfo.fullName); elementInfoPool.methodInfoMap.put(methodInfo.hashName(), methodInfo); } FieldDeclaration[] fieldDeclarations = node.getFields(); for (FieldDeclaration fieldDeclaration : fieldDeclarations) { List<FieldInfo> fieldInfos = createFieldInfos(fieldDeclaration, classInfo.fullName); for (FieldInfo fieldInfo : fieldInfos) elementInfoPool.fieldInfoMap.put(fieldInfo.hashName(), fieldInfo); } return true; }
Example 5
Source File: JavaTypeHierarchyExtractor.java From api-mining with GNU General Public License v3.0 | 4 votes |
@Override public boolean visit(final TypeDeclaration node) { for (final Object supType : node.superInterfaceTypes()) { Type superType = (Type) supType; if (superType.isParameterizedType()) { superType = ((ParameterizedType) superType).getType(); } final String qName = superType.resolveBinding().getErasure() .getQualifiedName(); if (className.isEmpty()) { addTypes(qName, currentPackageName + "." + node.getName()); } else { addTypes(qName, className.peek() + "." + node.getName()); } } Type superclassType = node.getSuperclassType(); if (superclassType != null) { if (superclassType.isParameterizedType()) { superclassType = ((ParameterizedType) superclassType) .getType(); } addTypes(superclassType.resolveBinding().getQualifiedName(), currentPackageName + "." + node.getName()); } if (className.isEmpty()) { className.push(currentPackageName + "." + node.getName().getIdentifier()); importedNames.put(node.getName().getIdentifier(), currentPackageName + "." + node.getName().getIdentifier()); } else { className.push(className.peek() + "." + node.getName().getIdentifier()); importedNames .put(node.getName().getIdentifier(), className.peek() + "." + node.getName().getIdentifier()); } return true; }
Example 6
Source File: JavaTypeHierarchyExtractor.java From tassal with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public boolean visit(final TypeDeclaration node) { for (final Object supType : node.superInterfaceTypes()) { Type superType = (Type) supType; if (superType.isParameterizedType()) { superType = ((ParameterizedType) superType).getType(); } final String qName = superType.resolveBinding().getErasure() .getQualifiedName(); if (className.isEmpty()) { addTypes(qName, currentPackageName + "." + node.getName()); } else { addTypes(qName, className.peek() + "." + node.getName()); } } Type superclassType = node.getSuperclassType(); if (superclassType != null) { if (superclassType.isParameterizedType()) { superclassType = ((ParameterizedType) superclassType) .getType(); } addTypes(superclassType.resolveBinding().getQualifiedName(), currentPackageName + "." + node.getName()); } if (className.isEmpty()) { className.push(currentPackageName + "." + node.getName().getIdentifier()); importedNames.put(node.getName().getIdentifier(), currentPackageName + "." + node.getName().getIdentifier()); } else { className.push(className.peek() + "." + node.getName().getIdentifier()); importedNames .put(node.getName().getIdentifier(), className.peek() + "." + node.getName().getIdentifier()); } return true; }
Example 7
Source File: JavaTypeHierarchyExtractor.java From codemining-core with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public boolean visit(final TypeDeclaration node) { for (final Object supType : node.superInterfaceTypes()) { Type superType = (Type) supType; if (superType.isParameterizedType()) { superType = ((ParameterizedType) superType).getType(); } final String qName = superType.resolveBinding().getErasure() .getQualifiedName(); if (className.isEmpty()) { addTypes(qName, currentPackageName + "." + node.getName()); } else { addTypes(qName, className.peek() + "." + node.getName()); } } Type superclassType = node.getSuperclassType(); if (superclassType != null) { if (superclassType.isParameterizedType()) { superclassType = ((ParameterizedType) superclassType) .getType(); } addTypes(superclassType.resolveBinding().getQualifiedName(), currentPackageName + "." + node.getName()); } if (className.isEmpty()) { className.push(currentPackageName + "." + node.getName().getIdentifier()); importedNames.put(node.getName().getIdentifier(), currentPackageName + "." + node.getName().getIdentifier()); } else { className.push(className.peek() + "." + node.getName().getIdentifier()); importedNames .put(node.getName().getIdentifier(), className.peek() + "." + node.getName().getIdentifier()); } return true; }