public Filer getFiler() { return delegate.getFiler(); }
SpecCompliantClassAP(AnnotationProcessorEnvironment env) { this.env = env; specCompliantAnnotation = (AnnotationTypeDeclaration) env .getTypeDeclaration("org.apache.vysper.compliance.SpecCompliant"); specCompliantCollectionAnnotation = (AnnotationTypeDeclaration) env .getTypeDeclaration("org.apache.vysper.compliance.SpecCompliance"); try { fileWriter = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, "", new File("spec_compliance.html"), null); } catch (IOException e) { throw new RuntimeException("could not write to output file", e); } }
/** * Get the writer for the specified java source file. * * @return the writer for the specified java source file. */ public PrintWriter getWriter() throws MissingParameterException, IOException { if (name == null) { throw new MissingParameterException("name"); } AnnotationProcessorEnvironment env = getAnnotationProcessorEnvironment(); return env.getFiler().createSourceFile(name); }
private PrintWriter openClassFile( String type ) { final String codepackage = "com.google.code.facebookapi"; final String mainClassName = "Facebook" + type + "RestClient"; final String baseClassName = mainClassName + "Base"; final String mainClass = codepackage + "." + mainClassName; final String baseClass = codepackage + "." + baseClassName; try { PrintWriter out = processingEnv.getFiler().createSourceFile( mainClass ); out.println( String.format( "package %s;", codepackage ) ); out.println(); if ( type.equals( "Jaxb" ) ) { out.println( "@SuppressWarnings(\"unchecked\")" ); } out.println( String.format( "public class %s extends %s {", mainClassName, baseClassName ) ); out.println(); CopyConstructorVisitor copyConstructors = new CopyConstructorVisitor( type, out ); ClassDeclaration clientBase = (ClassDeclaration) processingEnv.getTypeDeclaration( baseClass ); for ( ConstructorDeclaration cd : clientBase.getConstructors() ) { cd.accept( copyConstructors ); } return out; } catch ( IOException ex ) { System.err.println( "Ignoring IOException during: " + type + "; " + ex ); return null; } }
public void process() { try { buf = new StringBuilder(); Messager log = env.getMessager(); DeclarationVisitor scanner = DeclarationVisitors.getDeclarationScanner( new Visitor(), DeclarationVisitors.NO_OP); for (TypeDeclaration typeDecl : env.getSpecifiedTypeDeclarations()) { typeDecl.accept(scanner); } if (buf.length() > 0) { writer = env.getFiler().createTextFile(Filer.Location.CLASS_TREE, "", new File("META-INF/web-types"), "UTF-8"); writer.print(buf.toString()); writer.close(); } } catch (IOException e) { e.printStackTrace(); } } }
/** * Return the writer to the specified file. * * @return The writer to the specified file. */ public PrintWriter getWriter() throws IOException, MissingParameterException { if (getName() == null) { throw new MissingParameterException("name"); } AnnotationProcessorEnvironment env = getAnnotationProcessorEnvironment(); return env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, pkg, new File(getName()), charset); }
Filer filer = env.getFiler();
Filer filer = env.getFiler();
Filer filer = env.getFiler();