本文整理汇总了Java中com.jetbrains.php.PhpClassHierarchyUtils.processSuperMembers方法的典型用法代码示例。如果您正苦于以下问题:Java PhpClassHierarchyUtils.processSuperMembers方法的具体用法?Java PhpClassHierarchyUtils.processSuperMembers怎么用?Java PhpClassHierarchyUtils.processSuperMembers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jetbrains.php.PhpClassHierarchyUtils
的用法示例。
在下文中一共展示了PhpClassHierarchyUtils.processSuperMembers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: namedElementHasParentWithDoc
import com.jetbrains.php.PhpClassHierarchyUtils; //导入方法依赖的package包/类
static boolean namedElementHasParentWithDoc(final PhpNamedElement phpNamedElement)
{
final ArrayList<PhpElementWithModifier> results = new ArrayList<>(10);
if (phpNamedElement instanceof Method) {
PhpClassHierarchyUtils.processSuperMembers((PhpClassMember) phpNamedElement, (method, subClass, baseClass) -> {
results.add(method);
return true;
});
} else if (phpNamedElement instanceof PhpClass) {
results.addAll(PhpClassHierarchyUtils.getImmediateParents((PhpClass)phpNamedElement));
}
String commentString = "";
for (Object result : results) {
PhpNamedElement superMember = (PhpNamedElement) result;
if (superMember.isValid() && superMember.getDocComment() != null) {
commentString = superMember.getDocComment().getText();
}
if (commentString.length() > 0) {
break;
}
}
return (commentString.length() > 0);
}
示例2: getPlaceholderTextForCommentImpl
import com.jetbrains.php.PhpClassHierarchyUtils; //导入方法依赖的package包/类
private String getPlaceholderTextForCommentImpl(PhpDocCommentImpl psiElement) {
PsiElement phpNamedElement = psiElement.getOwner();
if (! psiElement.hasInheritDocTag()) {
return null;
}
final ArrayList<PhpElementWithModifier> results = new ArrayList<>(1);
if(phpNamedElement instanceof Method) {
PhpClassHierarchyUtils.processSuperMembers((PhpClassMember) phpNamedElement, (method, subClass, baseClass) -> {
results.add(method);
return true;
});
} else if(phpNamedElement instanceof PhpClass) {
results.addAll(PhpClassHierarchyUtils.getImmediateParents((PhpClass)phpNamedElement));
}
if (results.isEmpty()) {
return null;
}
for (Object result : results) {
PhpNamedElement superMember = (PhpNamedElement) result;
String commentString;
if (superMember.isValid() && superMember.getDocComment() != null) {
if (superMember.getDocComment().hasInheritDocTag()) {
return this.getPlaceholderTextForCommentImpl((PhpDocCommentImpl) superMember.getDocComment());
}
commentString = superMember.getDocComment().getText().replaceAll("\\s+", " ");
commentString = commentString.replaceAll("/\\*+", "");
commentString = commentString.replaceAll("\\*/", "");
commentString = commentString.replaceAll("^\\s\\*?", "");
commentString = commentString.replaceAll("\\s+\\*[\\s\\*]?\\s", " * ");
commentString = commentString.trim();
return commentString;
}
}
// no valid supermember found
return null;
}