本文整理了Java中com.sun.codemodel.JPackage.isUnnamed()
方法的一些代码示例,展示了JPackage.isUnnamed()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPackage.isUnnamed()
方法的具体详情如下:
包路径:com.sun.codemodel.JPackage
类名称:JPackage
方法名:isUnnamed
[英]Checks if this package is the root, unnamed package.
[中]检查此包是否为未命名的根包。
代码示例来源:origin: javaee/glassfish
public Writer openSource(JPackage pkg, String fileName) throws IOException {
String name;
if(pkg.isUnnamed())
name = fileName;
else
name = pkg.name()+'.'+fileName;
name = name.substring(0,name.length()-5); // strip ".java"
return filer.createSourceFile(name).openWriter();
}
代码示例来源:origin: com.sun.codemodel/codemodel
/**
* Reference a class within this package.
*/
public JClass ref(String name) throws ClassNotFoundException {
if (name.indexOf('.') >= 0)
throw new IllegalArgumentException("JClass name contains '.': " + name);
String n = "";
if (!isUnnamed())
n = this.name + '.';
n += name;
return owner.ref(Class.forName(n));
}
代码示例来源:origin: com.sun.codemodel/codemodel
public JAnnotationUse annotate(JClass clazz) {
if(isUnnamed())
throw new IllegalArgumentException("the root package cannot be annotated");
if(annotations==null)
annotations = new ArrayList<JAnnotationUse>();
JAnnotationUse a = new JAnnotationUse(clazz);
annotations.add(a);
return a;
}
代码示例来源:origin: com.sun.codemodel/codemodel
public OutputStream openBinary(JPackage pkg, String fileName) throws IOException {
String name = fileName;
if(!pkg.isUnnamed()) name = toDirName(pkg)+name;
zip.putNextEntry(new ZipEntry(name));
return filter;
}
代码示例来源:origin: sun-jaxb/jaxb-xjc
private void report(JPackage pkg, String fileName) {
if(pkg.isUnnamed()) progress.println(fileName);
else
progress.println(
pkg.name().replace('.',File.separatorChar)
+File.separatorChar+fileName);
}
代码示例来源:origin: com.unquietcode.tools.jcodemodel/codemodel
public OutputStream openBinary(JPackage pkg, String fileName) throws IOException {
String name = fileName;
if(!pkg.isUnnamed()) name = toDirName(pkg)+name;
zip.putNextEntry(new ZipEntry(name));
return filter;
}
代码示例来源:origin: com.sun.codemodel/codemodel
private void report(JPackage pkg, String fileName) {
if(pkg.isUnnamed()) progress.println(fileName);
else
progress.println(
pkg.name().replace('.',File.separatorChar)
+File.separatorChar+fileName);
}
代码示例来源:origin: javaee/jaxb-v2
public String process(String line) {
if(!line.startsWith("package ")) return line;
// replace package decl
if( pkg.isUnnamed() )
return null;
else
return "package "+pkg.name()+";";
}
};
代码示例来源:origin: javaee/jaxb-v2
public String fullName() {
if(pkg.isUnnamed())
return className;
else
return pkg.name()+'.'+className;
}
代码示例来源:origin: com.sun.codemodel/codemodel
public String process(String line) {
if(!line.startsWith("package ")) return line;
// replace package decl
if( pkg.isUnnamed() )
return null;
else
return "package "+pkg.name()+";";
}
};
代码示例来源:origin: org.glassfish.metro/webservices-tools
@Override
public OutputStream openBinary(JPackage pkg, String fileName) throws IOException {
final String name = pkg == null || pkg.isUnnamed() ? fileName : toDirName(pkg)+fileName;
zip.putNextEntry(new ZipEntry(name));
return filter;
}
代码示例来源:origin: org.glassfish.metro/webservices-tools
/**
* Reference a class within this package.
*/
public JClass ref(String name) throws ClassNotFoundException {
if (name.indexOf('.') >= 0)
throw new IllegalArgumentException("JClass name contains '.': " + name);
String n = "";
if (!isUnnamed())
n = this.name + '.';
n += name;
return owner.ref(Class.forName(n));
}
代码示例来源:origin: org.glassfish.metro/webservices-tools
public JAnnotationUse annotate(JClass clazz) {
if(isUnnamed())
throw new IllegalArgumentException("the root package cannot be annotated");
if(annotations==null)
annotations = new ArrayList<JAnnotationUse>();
JAnnotationUse a = new JAnnotationUse(clazz);
annotations.add(a);
return a;
}
代码示例来源:origin: highsource/maven-jaxb2-plugin
public OutputStream openBinary(JPackage pkg, String fileName)
throws IOException {
if (verbose) {
if (pkg.isUnnamed())
log.info("XJC writing: " + fileName);
else
log.info("XJC writing: "
+ pkg.name().replace('.', File.separatorChar)
+ File.separatorChar + fileName);
}
return core.openBinary(pkg, fileName);
}
代码示例来源:origin: highsource/maven-jaxb2-plugin
public Writer openSource(JPackage pkg, String fileName) throws IOException {
if (verbose) {
if (pkg.isUnnamed())
log.info("XJC writing: " + fileName);
else
log.info("XJC writing: "
+ pkg.name().replace('.', File.separatorChar)
+ File.separatorChar + fileName);
}
return core.openSource(pkg, fileName);
}
代码示例来源:origin: highsource/maven-jaxb2-plugin
public OutputStream openBinary(JPackage pkg, String fileName)
throws IOException {
if (verbose) {
if (pkg.isUnnamed())
log.info("XJC writing: " + fileName);
else
log.info("XJC writing: "
+ pkg.name().replace('.', File.separatorChar)
+ File.separatorChar + fileName);
}
return core.openBinary(pkg, fileName);
}
代码示例来源:origin: highsource/maven-jaxb2-plugin
public Writer openSource(JPackage pkg, String fileName) throws IOException {
if (verbose) {
if (pkg.isUnnamed())
log.info("XJC writing: " + fileName);
else
log.info("XJC writing: "
+ pkg.name().replace('.', File.separatorChar)
+ File.separatorChar + fileName);
}
return core.openSource(pkg, fileName);
}
代码示例来源:origin: highsource/maven-jaxb2-plugin
public Writer openSource(JPackage pkg, String fileName) throws IOException {
if (verbose) {
if (pkg.isUnnamed())
log.info("XJC writing: " + fileName);
else
log.info("XJC writing: "
+ pkg.name().replace('.', File.separatorChar)
+ File.separatorChar + fileName);
}
return core.openSource(pkg, fileName);
}
代码示例来源:origin: com.sun.codemodel/codemodel
/**
* Gets a reference to a sub package of this package.
*/
public JPackage subPackage( String pkg ) {
if(isUnnamed()) return owner()._package(pkg);
else return owner()._package(name+'.'+pkg);
}
代码示例来源:origin: sun-jaxb/jaxb-xjc
/**
* Gets the fully qualified name of this class.
*/
public String fullName() {
if (outer instanceof JDefinedClass)
return ((JDefinedClass) outer).fullName() + '.' + name();
JPackage p = _package();
if (p.isUnnamed())
return name();
else
return p.name() + '.' + name();
}
内容来源于网络,如有侵权,请联系作者删除!