本文整理汇总了Java中javax.lang.model.element.ExecutableElement.equals方法的典型用法代码示例。如果您正苦于以下问题:Java ExecutableElement.equals方法的具体用法?Java ExecutableElement.equals怎么用?Java ExecutableElement.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.lang.model.element.ExecutableElement
的用法示例。
在下文中一共展示了ExecutableElement.equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isMatch
import javax.lang.model.element.ExecutableElement; //导入方法依赖的package包/类
private boolean isMatch(Element element, Element elementToFind) {
if(element == null) {
return false;
}
if(allMethods == null || element.getKind() != ElementKind.METHOD) {
return element.equals(elementToFind);
} else {
for (ElementHandle<ExecutableElement> mh: allMethods) {
ExecutableElement baseMethod = mh.resolve(workingCopy);
if (baseMethod==null) {
Logger.getLogger("org.netbeans.modules.refactoring.java").log(Level.INFO, "DeleteTransformer cannot resolve {0}", mh);
continue;
}
if (baseMethod.equals(element) || workingCopy.getElements().overrides((ExecutableElement)element, baseMethod, workingCopy.getElementUtilities().enclosingTypeElement(baseMethod))) {
return true;
}
}
}
return false;
}
示例2: isSameOrOverrides
import javax.lang.model.element.ExecutableElement; //导入方法依赖的package包/类
private boolean isSameOrOverrides(ExecutableElement m1, Collection<ExecutableElement> methods) {
for (ExecutableElement method : methods) {
if (m1.equals(method) || cc.getElements().overrides(m1, method, (TypeElement) m1.getEnclosingElement())) {
return true;
}
}
return false;
}
示例3: executableMembersEqual
import javax.lang.model.element.ExecutableElement; //导入方法依赖的package包/类
/**
* @param e1 the first method to compare.
* @param e2 the second method to compare.
* @return true if member1 overrides/hides or is overriden/hidden by member2.
*/
public boolean executableMembersEqual(ExecutableElement e1, ExecutableElement e2) {
// TODO: investigate if Elements.hides(..) will work here.
if (isStatic(e1) && isStatic(e2)) {
List<? extends VariableElement> parameters1 = e1.getParameters();
List<? extends VariableElement> parameters2 = e2.getParameters();
if (e1.getSimpleName().equals(e2.getSimpleName()) &&
parameters1.size() == parameters2.size()) {
int j;
for (j = 0 ; j < parameters1.size(); j++) {
VariableElement v1 = parameters1.get(j);
VariableElement v2 = parameters2.get(j);
String t1 = getTypeName(v1.asType(), true);
String t2 = getTypeName(v2.asType(), true);
if (!(t1.equals(t2) ||
isTypeVariable(v1.asType()) || isTypeVariable(v2.asType()))) {
break;
}
}
if (j == parameters1.size()) {
return true;
}
}
return false;
} else {
return elementUtils.overrides(e1, e2, getEnclosingTypeElement(e1)) ||
elementUtils.overrides(e2, e1, getEnclosingTypeElement(e2)) ||
e1.equals(e2);
}
}