本文整理汇总了Java中javax.tools.JavaFileObject.Kind.CLASS属性的典型用法代码示例。如果您正苦于以下问题:Java Kind.CLASS属性的具体用法?Java Kind.CLASS怎么用?Java Kind.CLASS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.tools.JavaFileObject.Kind
的用法示例。
在下文中一共展示了Kind.CLASS属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getJavaFileForOutput
@Override
public JavaFileObject getJavaFileForOutput(Location location, String className, Kind kind, FileObject sibling) throws IOException
{
if (kind != Kind.CLASS)
{
return _wrapped.getJavaFileForOutput(location, className, kind, sibling);
}
if (className.contains("/"))
{
className = className.replace('/', '.');
}
ScriptingOutputFileObject fileObject;
if (sibling != null)
{
fileObject = new ScriptingOutputFileObject(Paths.get(sibling.getName()), className, className.substring(className.lastIndexOf('.') + 1));
}
else
{
fileObject = new ScriptingOutputFileObject(null, className, className.substring(className.lastIndexOf('.') + 1));
}
_classOutputs.add(fileObject);
return fileObject;
}
示例2: getKind
public static Kind getKind(String name) {
if (name.endsWith(Kind.CLASS.extension))
return Kind.CLASS;
else if (name.endsWith(Kind.SOURCE.extension))
return Kind.SOURCE;
else if (name.endsWith(Kind.HTML.extension))
return Kind.HTML;
else
return Kind.OTHER;
}
示例3: complete
@Override
public void complete(Symbol sym) throws CompletionFailure {
ModuleSymbol msym = moduleFinder.findModule((ModuleSymbol) sym);
if (msym.kind == ERR) {
//make sure the module is initialized:
msym.directives = List.nil();
msym.exports = List.nil();
msym.provides = List.nil();
msym.requires = List.nil();
msym.uses = List.nil();
} else if ((msym.flags_field & Flags.AUTOMATIC_MODULE) != 0) {
setupAutomaticModule(msym);
} else {
msym.module_info.complete();
}
// If module-info comes from a .java file, the underlying
// call of classFinder.fillIn will have called through the
// source completer, to Enter, and then to Modules.enter,
// which will call completeModule.
// But, if module-info comes from a .class file, the underlying
// call of classFinder.fillIn will just call ClassReader to read
// the .class file, and so we call completeModule here.
if (msym.module_info.classfile == null || msym.module_info.classfile.getKind() == Kind.CLASS) {
completeModule(msym);
}
}
示例4: visitExports
@Override
public void visitExports(JCExports tree) {
Iterable<Symbol> packageContent = tree.directive.packge.members().getSymbols();
List<JavaFileObject> filesToCheck = List.nil();
boolean packageNotEmpty = false;
for (Symbol sym : packageContent) {
if (sym.kind != Kinds.Kind.TYP)
continue;
ClassSymbol csym = (ClassSymbol) sym;
if (sym.completer.isTerminal() ||
csym.classfile.getKind() == Kind.CLASS) {
packageNotEmpty = true;
filesToCheck = List.nil();
break;
}
if (csym.classfile.getKind() == Kind.SOURCE) {
filesToCheck = filesToCheck.prepend(csym.classfile);
}
}
for (JavaFileObject jfo : filesToCheck) {
if (findPackageInFile.findPackageNameOf(jfo) == tree.directive.packge.fullname) {
packageNotEmpty = true;
break;
}
}
if (!packageNotEmpty) {
log.error(tree.qualid.pos(), Errors.PackageEmptyOrNotFound(tree.directive.packge));
}
msym.directives = msym.directives.prepend(tree.directive);
}
示例5: getJavaFileForInput
@Override
public JavaFileObject getJavaFileForInput(Location location, String className, Kind kind) throws IOException {
if (location != StandardLocation.PLATFORM_CLASS_PATH || kind != Kind.CLASS)
return null;
return className2File.get(className);
}
示例6: MemoryFileObject
/**
* Constructs a memory file object.
* @param name binary name of the class to be stored in this file object
*/
MemoryFileObject(Location location, String name, JavaFileObject.Kind kind) {
super(URI.create("mfm:///" + name.replace('.','/') + kind.extension),
Kind.CLASS);
this.location = location;
this.name = name;
}
示例7: getFiles
@NonNull
@Override
public Iterable<JavaFileObject> getFiles(
@NonNull final String folderName,
@NullAllowed final ClassPath.Entry entry,
@NullAllowed final Set<JavaFileObject.Kind> kinds,
@NullAllowed final JavaFileFilterImplementation filter,
final boolean recursive) throws IOException {
final FileObject folder = root.getFileObject(folderName);
if (folder == null || !(entry == null || entry.includes(folder))) {
return Collections.<JavaFileObject>emptySet();
}
final Enumeration<? extends FileObject> children;
final List<JavaFileObject> result;
if (recursive) {
children = Enumerations.filter(
folder.getChildren(recursive),
(p,x)->{
return !p.isFolder() && isInJavaPackage(folder,p) ?
p :
null;
});
result = new ArrayList<>(/*unknown size*/);
} else {
final FileObject[] chlds = folder.getChildren();
children = Enumerations.array(chlds);
result = new ArrayList<>(chlds.length);
}
while (children.hasMoreElements()) {
final FileObject fo = children.nextElement();
if (fo.isData() && (entry == null || entry.includes(fo))) {
final Kind kind = FileObjects.getKind(fo.getExt());
if (kinds == null || kinds.contains (kind)) {
JavaFileObject file;
if (kind == Kind.CLASS) {
file = FileObjects.fileObjectFileObject(fo, root, filter, null);
} else {
file = FileObjects.sourceFileObject(fo, root, filter,false);
}
result.add(file);
}
}
}
return result;
}
示例8: Output
Output(String name) {
super(name, Kind.CLASS);
}
示例9: list
Iterable<JavaFileObject> list(Location location,
PackageSymbol p,
String packageName,
Set<Kind> kinds) throws IOException {
Iterable<JavaFileObject> listed = fileManager.list(location,
packageName,
EnumSet.allOf(Kind.class),
false);
return () -> new Iterator<JavaFileObject>() {
private final Iterator<JavaFileObject> original = listed.iterator();
private JavaFileObject next;
@Override
public boolean hasNext() {
if (next == null) {
while (original.hasNext()) {
JavaFileObject fo = original.next();
if (fo.getKind() != Kind.CLASS &&
fo.getKind() != Kind.SOURCE &&
!isSigFile(currentLoc, fo)) {
p.flags_field |= Flags.HAS_RESOURCE;
}
if (kinds.contains(fo.getKind())) {
next = fo;
break;
}
}
}
return next != null;
}
@Override
public JavaFileObject next() {
if (!hasNext())
throw new NoSuchElementException();
JavaFileObject result = next;
next = null;
return result;
}
};
}
示例10: getKind
@Override
public Kind getKind() {
return Kind.CLASS;
}
示例11: JavaClassInArray
/**
* Constructs a JavaClassInArray object.
* @param name binary name of the class to be stored in this file object
*/
JavaClassInArray(String name) {
super(uriFromString("mfm:///" + name.replace('.','/') + Kind.CLASS.extension),
Kind.CLASS);
this.name = name;
}