本文整理汇总了Java中org.eclipse.jdt.core.ITypeHierarchy.getImplementingClasses方法的典型用法代码示例。如果您正苦于以下问题:Java ITypeHierarchy.getImplementingClasses方法的具体用法?Java ITypeHierarchy.getImplementingClasses怎么用?Java ITypeHierarchy.getImplementingClasses使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.ITypeHierarchy
的用法示例。
在下文中一共展示了ITypeHierarchy.getImplementingClasses方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hierarchyDeclaresMethodName
import org.eclipse.jdt.core.ITypeHierarchy; //导入方法依赖的package包/类
static final IMethod[] hierarchyDeclaresMethodName(
IProgressMonitor pm, ITypeHierarchy hierarchy, IMethod method, String newName)
throws CoreException {
try {
Set<IMethod> result = new HashSet<IMethod>();
IType type = method.getDeclaringType();
IMethod foundMethod =
Checks.findMethod(newName, method.getParameterTypes().length, false, type);
if (foundMethod != null) result.add(foundMethod);
IMethod[] foundInHierarchyClasses =
classesDeclareMethodName(
hierarchy, Arrays.asList(hierarchy.getAllClasses()), method, newName);
if (foundInHierarchyClasses != null) result.addAll(Arrays.asList(foundInHierarchyClasses));
IType[] implementingClasses = hierarchy.getImplementingClasses(type);
IMethod[] foundInImplementingClasses =
classesDeclareMethodName(hierarchy, Arrays.asList(implementingClasses), method, newName);
if (foundInImplementingClasses != null)
result.addAll(Arrays.asList(foundInImplementingClasses));
return result.toArray(new IMethod[result.size()]);
} finally {
if (pm != null) {
pm.done();
}
}
}
示例2: isImplementedInSupertype
import org.eclipse.jdt.core.ITypeHierarchy; //导入方法依赖的package包/类
@Override
public boolean isImplementedInSupertype(final IType objectClass, final String interfaceName)
throws JavaModelException {
String simpleName = getSimpleInterfaceName(interfaceName);
ITypeHierarchy typeHierarchy = objectClass.newSupertypeHierarchy(null);
IType[] interfaces = typeHierarchy.getAllInterfaces();
for (int i = 0; i < interfaces.length; i++) {
if (interfaces[i].getElementName().equals(simpleName)) {
IType in = interfaces[i];
IType[] types = typeHierarchy.getImplementingClasses(in);
for (int j = 0; j < types.length; j++) {
if (!types[j].getFullyQualifiedName().equals(objectClass.getFullyQualifiedName())) {
return true;
}
}
break;
}
}
return false;
}
示例3: hierarchyDeclaresMethodName
import org.eclipse.jdt.core.ITypeHierarchy; //导入方法依赖的package包/类
final static IMethod[] hierarchyDeclaresMethodName(IProgressMonitor pm, ITypeHierarchy hierarchy, IMethod method, String newName) throws CoreException {
try {
Set<IMethod> result= new HashSet<IMethod>();
IType type= method.getDeclaringType();
IMethod foundMethod= Checks.findMethod(newName, method.getParameterTypes().length, false, type);
if (foundMethod != null)
result.add(foundMethod);
IMethod[] foundInHierarchyClasses= classesDeclareMethodName(hierarchy, Arrays.asList(hierarchy.getAllClasses()), method, newName);
if (foundInHierarchyClasses != null)
result.addAll(Arrays.asList(foundInHierarchyClasses));
IType[] implementingClasses= hierarchy.getImplementingClasses(type);
IMethod[] foundInImplementingClasses= classesDeclareMethodName(hierarchy, Arrays.asList(implementingClasses), method, newName);
if (foundInImplementingClasses != null)
result.addAll(Arrays.asList(foundInImplementingClasses));
return result.toArray(new IMethod[result.size()]);
} finally {
if (pm != null) {
pm.done();
}
}
}
示例4: findTests
import org.eclipse.jdt.core.ITypeHierarchy; //导入方法依赖的package包/类
private List<ICompilationUnit> findTests(IProgressMonitor monitor) throws JavaModelException {
List<ICompilationUnit> units = new ArrayList<ICompilationUnit>();
ITypeHierarchy th = testInterface.findPrimaryType().newTypeHierarchy(testInterface.getJavaProject(),monitor);
IType[] types = th.getImplementingClasses(testInterface.findPrimaryType());
for (int i = 0; i < types.length; i++) {
units.add(types[i].getCompilationUnit());
}
return units;
}