blob: 60c720f8c8099dcdfb6e76b7cf723a0ff5b078b2 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2006 BEA Systems, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* jgarms@bea.com - initial API and implementation
*
*******************************************************************************/
package org.eclipse.jdt.apt.tests.annotations.filegen;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import org.eclipse.jdt.apt.tests.annotations.BaseProcessor;
import com.sun.mirror.apt.AnnotationProcessorEnvironment;
import com.sun.mirror.apt.Filer;
public class TextGenAnnotationProcessor extends BaseProcessor {
public static final String FILE_NAME = "TextFile.txt";
public TextGenAnnotationProcessor(AnnotationProcessorEnvironment env) {
super(env);
}
public void process() {
Filer f = _env.getFiler();
try {
PrintWriter writer = f.createTextFile(
Filer.Location.CLASS_TREE,
"",
new File(FILE_NAME),
null);
writer.print(TEXT);
writer.close();
}
catch (IOException ioe) {
throw new RuntimeException("Could not generate text file",ioe);
}
}
private static final String TEXT = "This is some text generated by an annotation processor";
}