X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=source%2Fmir%2Fgenerator%2FGenerator.java;fp=source%2Fmir%2Fgenerator%2FGenerator.java;h=f225bd74754bbf3a4817fff8bbea56babd605a2c;hb=c9ac8fa71b679f8d967aac901bbef945c13b94c9;hp=805d0cccea2ded472b9b5a9bbc0a5b4cd69b23a9;hpb=d63595f89aaa4b6a524dc0b4af9e0eef888f4c6b;p=mir.git diff --git a/source/mir/generator/Generator.java b/source/mir/generator/Generator.java index 805d0ccc..f225bd74 100755 --- a/source/mir/generator/Generator.java +++ b/source/mir/generator/Generator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2005 The Mir-coders group * * This file is part of Mir. * @@ -18,46 +18,46 @@ * 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; } }