/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2005 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with any library licensed under the Apache Software License,
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
- * (or with modified versions of the above that use the same license as the above),
- * and distribute linked combinations including the two. You must obey the
- * GNU General Public License in all respects for all of the code used other than
- * the above mentioned libraries. If you modify this file, you may extend this
+ * the code of this program with any library licensed under the Apache Software License.
+ * You must obey the GNU General Public License in all respects for all of the code used
+ * other than the above mentioned libraries. If you modify this file, you may extend this
* exception to your version of the file, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.generator;
-import java.io.PrintWriter;
-import java.io.Reader;
+import mir.log.LoggerWrapper;
+
import java.util.List;
import java.util.Map;
-import mir.log.LoggerWrapper;
-
/**
- * Interface representing a "generator", typically a template engine/
+ * A "generator" is an abstraction for a template
+ * If you need a generator, use MirGeneratorLocalizer
*/
public interface Generator {
- public void generate(Object anOutputWriter, Map aValues, LoggerWrapper aLogger) throws GeneratorExc, GeneratorFailure;
+ /** This is the method that actually runs the template engine on this template
+ * @param anOutputWriter a writer to the file we want to generate, use the
+ * MirGeneratorLocalizer to create a writer.
+ * @param aValues the key/value pairs which the template engine will use as variables
+ */
+ void generate(Object anOutputWriter, Map aValues, LoggerWrapper aLogger) throws GeneratorExc, GeneratorFailure;
+
+ interface Library {
+ Generator makeGenerator(String anIdentifier, Interceptor anInterceptor) throws GeneratorExc, GeneratorFailure;
+ }
- public static interface Library {
- public Generator makeGenerator(String anIdentifier) throws GeneratorExc, GeneratorFailure;
+ interface LibraryFactory {
+ Library makeLibrary(String anInitializationString) throws GeneratorExc, GeneratorFailure ;
}
- public static interface LibraryFactory {
- public Library makeLibrary(String anInitializationString) throws GeneratorExc, GeneratorFailure ;
+ interface Interceptor {
+ Object intercept(Object anObject);
}
/** interface for a generator implementation independent function */
- public static interface Function {
+ interface Function {
/** performs the function with the given parameters */
- public Object perform(List aParameters) throws GeneratorExc, GeneratorFailure;
- }
-
- public static interface Transformer {
- public void perform(Reader aSource, PrintWriter anOutput) throws GeneratorExc, GeneratorFailure;
+ Object perform(List aParameters) throws GeneratorExc, GeneratorFailure;
}
}