* @throws JavaModelException
*/
public static boolean isWicketComponent(final IJavaElement javaElement) throws JavaModelException {
Assert.isNotNull(javaElement);
if (javaElement instanceof ResolvedSourceMethod) {
final ResolvedSourceMethod method = (ResolvedSourceMethod) javaElement;
if ("QComponent;".equals(method.getReturnType())) {
return true;
}
final IType type = method.getDeclaringType();
if (type != null) {
if (type.getFullyQualifiedName().equals(TypeHelper.COMPONENT)) {
return true;
}
return hierarchyContainsComponent(type);
}
}
if ((javaElement instanceof ResolvedBinaryMethod)) {
final ResolvedBinaryMethod method = (ResolvedBinaryMethod) javaElement;
if ("V;".equals(method.getReturnType())) {
return true;
}
final IType type = method.getDeclaringType();
if (type != null) {
if (type.getFullyQualifiedName().equals(TypeHelper.COMPONENT)) {
return true;
}
return hierarchyContainsComponent(type);