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(); }
/** * 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)); }
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; }
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; }
private void report(JPackage pkg, String fileName) { if(pkg.isUnnamed()) progress.println(fileName); else progress.println( pkg.name().replace('.',File.separatorChar) +File.separatorChar+fileName); }
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; }
private void report(JPackage pkg, String fileName) { if(pkg.isUnnamed()) progress.println(fileName); else progress.println( pkg.name().replace('.',File.separatorChar) +File.separatorChar+fileName); }
public String process(String line) { if(!line.startsWith("package ")) return line; // replace package decl if( pkg.isUnnamed() ) return null; else return "package "+pkg.name()+";"; } };
public String fullName() { if(pkg.isUnnamed()) return className; else return pkg.name()+'.'+className; }
public String process(String line) { if(!line.startsWith("package ")) return line; // replace package decl if( pkg.isUnnamed() ) return null; else return "package "+pkg.name()+";"; } };
@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; }
/** * 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)); }
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; }
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); }
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); }
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); }
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); }
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); }
/** * 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); }
/** * 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(); }