KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > freemarker > ext > rhino > RhinoWrapper


1 package freemarker.ext.rhino;
2
3 import org.mozilla.javascript.Scriptable;
4
5 import freemarker.ext.beans.BeansWrapper;
6 import freemarker.template.TemplateModel;
7 import freemarker.template.TemplateModelException;
8
9 /**
10  * <p><font color="red">Experimental: no backward compatibility guarantees</font>;
11  * any feedback is highly welcome!</p>
12  *
13  * @author Attila Szegedi
14  * @version $Id: RhinoWrapper.java,v 1.2 2005/06/22 10:52:52 ddekany Exp $
15  */

16 public class RhinoWrapper extends BeansWrapper {
17
18     public TemplateModel wrap(Object JavaDoc obj) throws TemplateModelException {
19         if(obj instanceof Scriptable) {
20             return getInstance(obj, RhinoScriptableModel.FACTORY);
21         }
22         return super.wrap(obj);
23     }
24 }
25
Popular Tags