velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject svn commit: r687133 - /velocity/engine/trunk/xdocs/docs/developer-guide.xml
Date Tue, 19 Aug 2008 19:07:21 GMT
Author: nbubna
Date: Tue Aug 19 12:07:21 2008
New Revision: 687133

VELOCITY-102 document static utility class support


Modified: velocity/engine/trunk/xdocs/docs/developer-guide.xml
--- velocity/engine/trunk/xdocs/docs/developer-guide.xml (original)
+++ velocity/engine/trunk/xdocs/docs/developer-guide.xml Tue Aug 19 12:07:21 2008
@@ -60,6 +60,7 @@
 <li><a href="#thebasics">The Basics</a></li>
 <li><a href="#supportforiterativeobjectsforforeach">Support for Iterative Objects
for #foreach()</a></li>
+<li><a href="#supportforstaticclasses">Support for "Static Classes"</a></li>
 <li><a href="#contextchaining">Context Chaining</a></li>
 <li><a href="#objectscreatedinthetemplate">Objects Created by the Template</a></li>
 <li><a href="#othercontextissues">Other Context Issues</a></li>
@@ -654,6 +655,22 @@
 careful when you place an Iterator into the context.
+<a name="supportforstaticclasses"><strong>Support for "Static Classes"</strong></a>
+<p>Not all classes are instantiable.  Classes like <code>java.lang.Math</code>
+do not provide any public constructor, and yet may contain useful static methods.
+In order to access these static methods from a template, you can simply add the
+class itself to the context:
+context.put("Math", Math.class);
+<p>This will allow you to call any public static method in <code>java.lang.Math</code>
+on the <code>$Math</code> reference in the template.
 <a name="contextchaining"><strong>Context Chaining</strong></a>

View raw message