Date: 2004-10-14T19:36:36
Editor: ShinobuKawai <[EMAIL PROTECTED]>
Wiki: Jakarta-Velocity Wiki
Page: ArrayTool
URL: http://wiki.apache.org/jakarta-velocity/ArrayTool
Javadoc
Change Log:
------------------------------------------------------------------------------
@@ -22,8 +22,16 @@
import java.util.List;
/**
+ * Tool for working with arrays in Velocity templates.
+ * It provides a method to get the length and
+ * specified elements of an array object.
+ * Also provides a method to convert arrays into java.util.List's.
+ *
* <p><pre>
* Example uses:
+ * $primes -> new int[] {2, 3, 5, 7}
+ * $array.length($primes) -> 4
+ * $array.get($primes, 2) -> 5
*
* Example toolbox.xml config (if you want to use this with VelocityView):
* <tool>
@@ -51,25 +59,25 @@
}
/**
- * Converts an array object into a List.
+ * Converts an array object into a java.util.List.
* <ul>
* <li>
- * If the object is a List, it will return the List itself.
+ * If the object is a java.util.List, it will return the object itself.
* </li>
* <li>
* If the object is an array of an Object,
- * it will return a List of the elements.
+ * it will return a java.util.List of the elements.
* </li>
* <li>
* If the object is an array of a primitive type,
- * it will return a List of the elements wrapped in their wrapper class.
+ * it will return a java.util.List of the elements wrapped in their wrapper
class.
* </li>
* <li>
* If the object is none of the above, it will return null.
* </li>
* </ul>
* @param array an array object.
- * @return the converted List.
+ * @return the converted java.util.List.
*/
public List list(Object array)
{
@@ -170,7 +178,7 @@
* It will return null under the following conditions:
* <ul>
* <li><code>array</code> is null.</li>
- * <li><code>array</code> is neither an array nor a List.</li>
+ * <li><code>array</code> is neither an array nor a java.util.List.</li>
* <li><code>array</code> doesn't have an <code>index</code>th value.</li>
* </ul>
* @param array the array object.
@@ -194,7 +202,7 @@
* It will return null under the following conditions:
* <ul>
* <li><code>array</code> is null.</li>
- * <li><code>array</code> is neither an array nor a List.</li>
+ * <li><code>array</code> is neither an array nor a java.util.List.</li>
* </ul>
* @param array the array object.
* @return the length of an array.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]