br.usp.ime.xpusp.util
Interface ArrayBuilder
- All Known Implementing Classes:
- ArrayBuilderImpl, XpuspInfo
- public interface ArrayBuilder
This is the interface for the array builder. The array builder is used to construct arrays inside velocity templates.
The $xpuspinfo velocity reference to an instance of XpuspInfo
which implements ArrayBuilder can be used
to start the process. Sort of like this:
#set ($a = "This is a string")
#set ($b = $a.Class)
#set ($c = 1)
$xpuspinfo.arrayAdd($a).arrayAdd($b).arrayAdd($c).toArray();
//This would return {"This is a string", String.class, new Integer(1)}
or even
#foreach($o in $xpuspinfo.arrayAdd($a).arrayAdd($b).arrayAdd($c).toVector())
$o
#end
//would result in:
This is a string
class java.lang.String
1
arrayAdd
public ArrayBuilder arrayAdd(java.lang.Object o)
- Returns:
- the current ArrayBuilder with the
o
added to it
arrayAdd
public ArrayBuilder arrayAdd(boolean o)
- Returns:
- the current ArrayBuilder with the
o
added to it
arrayAdd
public ArrayBuilder arrayAdd(char o)
- Returns:
- the current ArrayBuilder with the
o
added to it
arrayAdd
public ArrayBuilder arrayAdd(byte o)
- Returns:
- the current ArrayBuilder with the
o
added to it
arrayAdd
public ArrayBuilder arrayAdd(short o)
- Returns:
- the current ArrayBuilder with the
o
added to it
arrayAdd
public ArrayBuilder arrayAdd(int o)
- Returns:
- the current ArrayBuilder with the
o
added to it
arrayAdd
public ArrayBuilder arrayAdd(long o)
- Returns:
- the current ArrayBuilder with the
o
added to it
arrayAdd
public ArrayBuilder arrayAdd(float o)
- Returns:
- the current ArrayBuilder with the
o
added to it
arrayAdd
public ArrayBuilder arrayAdd(double o)
- Returns:
- the current ArrayBuilder with the
o
added to it
toArray
public java.lang.Object[] toArray()
- Example:
ArrayBuilder ab = ...;
ab.arrayAdd(1).arrayAdd("Test").toArray();
//returns
{new Integer(1), "Test"}
- Returns:
- an Object[] with all the Objects and primitives added to the ArrayBuilder via arrayAdd
toVector
public java.util.Vector toVector()
- Returns:
- a Vector with all the Objects and primitives added to the ArrayBuidler via arrayAdd
- See Also:
toArray()