本文整理汇总了Java中javax.tools.JavaFileObject.isNameCompatible方法的典型用法代码示例。如果您正苦于以下问题:Java JavaFileObject.isNameCompatible方法的具体用法?Java JavaFileObject.isNameCompatible怎么用?Java JavaFileObject.isNameCompatible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.tools.JavaFileObject
的用法示例。
在下文中一共展示了JavaFileObject.isNameCompatible方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extraFileActions
import javax.tools.JavaFileObject; //导入方法依赖的package包/类
/**
* Override extraFileActions to check for package documentation
*/
@Override
protected void extraFileActions(PackageSymbol pack, JavaFileObject fo) {
if (fo.isNameCompatible("package", JavaFileObject.Kind.HTML)) {
pack.sourcefile = fo;
}
}
示例2: isPkgInfo
import javax.tools.JavaFileObject; //导入方法依赖的package包/类
private boolean isPkgInfo(JavaFileObject fo, JavaFileObject.Kind kind) {
return fo.isNameCompatible("package-info", kind);
}
示例3: scan
import javax.tools.JavaFileObject; //导入方法依赖的package包/类
public Void scan(DocCommentTree tree, TreePath p) {
env.setCurrent(p, tree);
boolean isOverridingMethod = !env.currOverriddenMethods.isEmpty();
if (p.getLeaf() == p.getCompilationUnit()) {
// If p points to a compilation unit, the implied declaration is the
// package declaration (if any) for the compilation unit.
// Handle this case specially, because doc comments are only
// expected in package-info files.
JavaFileObject fo = p.getCompilationUnit().getSourceFile();
boolean isPkgInfo = fo.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE);
if (tree == null) {
if (isPkgInfo)
reportMissing("dc.missing.comment");
return null;
} else {
if (!isPkgInfo)
reportReference("dc.unexpected.comment");
}
} else {
if (tree == null) {
if (!isSynthetic() && !isOverridingMethod)
reportMissing("dc.missing.comment");
return null;
}
}
tagStack.clear();
currHeaderTag = null;
foundParams.clear();
foundThrows.clear();
foundInheritDoc = false;
foundReturn = false;
scan(new DocTreePath(p, tree), null);
if (!isOverridingMethod) {
switch (env.currElement.getKind()) {
case METHOD:
case CONSTRUCTOR: {
ExecutableElement ee = (ExecutableElement) env.currElement;
checkParamsDocumented(ee.getTypeParameters());
checkParamsDocumented(ee.getParameters());
switch (ee.getReturnType().getKind()) {
case VOID:
case NONE:
break;
default:
if (!foundReturn
&& !foundInheritDoc
&& !env.types.isSameType(ee.getReturnType(), env.java_lang_Void)) {
reportMissing("dc.missing.return");
}
}
checkThrowsDocumented(ee.getThrownTypes());
}
}
}
return null;
}
示例4: extraFileActions
import javax.tools.JavaFileObject; //导入方法依赖的package包/类
/**
* Override extraFileActions to check for package documentation
*/
@Override
protected void extraFileActions(PackageSymbol pack, JavaFileObject fo) {
if (fo.isNameCompatible("package", JavaFileObject.Kind.HTML))
docenv.getPackageDoc(pack).setDocPath(fo);
}
示例5: scan
import javax.tools.JavaFileObject; //导入方法依赖的package包/类
public Void scan(DocCommentTree tree, TreePath p) {
env.initTypes();
env.setCurrent(p, tree);
boolean isOverridingMethod = !env.currOverriddenMethods.isEmpty();
JavaFileObject fo = p.getCompilationUnit().getSourceFile();
if (p.getLeaf().getKind() == Tree.Kind.PACKAGE) {
// If p points to a package, the implied declaration is the
// package declaration (if any) for the compilation unit.
// Handle this case specially, because doc comments are only
// expected in package-info files.
boolean isPkgInfo = fo.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE);
if (tree == null) {
if (isPkgInfo)
reportMissing("dc.missing.comment");
return null;
} else {
if (!isPkgInfo)
reportReference("dc.unexpected.comment");
}
} else if (tree != null && fo.isNameCompatible("package", JavaFileObject.Kind.HTML)) {
// a package.html file with a DocCommentTree
if (tree.getFullBody().isEmpty()) {
reportMissing("dc.missing.comment");
return null;
}
} else {
if (tree == null) {
if (!isSynthetic() && !isOverridingMethod)
reportMissing("dc.missing.comment");
return null;
}
}
tagStack.clear();
currHeaderTag = null;
foundParams.clear();
foundThrows.clear();
foundInheritDoc = false;
foundReturn = false;
hasNonWhitespaceText = false;
scan(new DocTreePath(p, tree), null);
if (!isOverridingMethod) {
switch (env.currElement.getKind()) {
case METHOD:
case CONSTRUCTOR: {
ExecutableElement ee = (ExecutableElement) env.currElement;
checkParamsDocumented(ee.getTypeParameters());
checkParamsDocumented(ee.getParameters());
switch (ee.getReturnType().getKind()) {
case VOID:
case NONE:
break;
default:
if (!foundReturn
&& !foundInheritDoc
&& !env.types.isSameType(ee.getReturnType(), env.java_lang_Void)) {
reportMissing("dc.missing.return");
}
}
checkThrowsDocumented(ee.getThrownTypes());
}
}
}
return null;
}
示例6: isModuleInfo
import javax.tools.JavaFileObject; //导入方法依赖的package包/类
private boolean isModuleInfo(JavaFileObject fo, JavaFileObject.Kind kind) {
return fo.isNameCompatible("module-info", kind);
}