001// Copyright (c) 2001 Hursh Jain (http://www.mollypages.org) 
002// The Molly framework is freely distributable under the terms of an
003// MIT-style license. For details, see the molly pages web site at:
004// http://www.mollypages.org/. Use, modify, have fun !
005
006package fc.util;
007
008import java.io.*;
009import java.util.*;
010
011/**
012Should be implemented for custom code functionality inside a 
013{@link fc.util.Template}. Implementing classes <b>must</b> have
014a no-arg constructor. It is guaranteed that only one instance
015of this class will be instantiated by the engine, although
016multiple threads may possible use this class at the same time.
017
018@author hursh jain
019**/
020public interface CustomCode 
021{
022/**
023Called back from the template engine while substiting data inside
024a template. 
025@param  writer  can be used to write data at the  point in the merged 
026        file where the custom code was called. This writer
027        should <b>not</b> be closed, otherwise the template engine
028        will not be able to proceed after this method is invoked (since
029        the template engine also uses the same writer.
030@param  env   a reference to the template engine, can be used to
031        invoke methods in the engine.
032**/
033public void code(Writer writer, Template env) throws IOException;
034}           //~interface CustomCode