本文整理匯總了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);
}
}