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