java.lang.Object
org.omnifaces.el.functions.Arrays
Collection of EL functions for array manipulation: o:createArray(), o:createIntegerArray(),
o:contains() and o:reverseArray().
- Author:
- Bauke Scholtz
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanReturnstrueif the string representation of an item of the given array equals to the string representation of the given item.static Object[]createArray(int size) Creates and returns a dummy object array of the given size.static Integer[]createIntegerArray(int begin, int end) Creates and returns an integer array which starts at the given integer and ends at the given integer, inclusive.static Object[]reverseArray(Object[] array) Returns a copy of the array with items in reversed order.
-
Method Details
-
createArray
Creates and returns a dummy object array of the given size. This is useful if you want to iterate n times over an<ui:repeat>, which doesn't support EL inbeginandendattributes.- Parameters:
size- The size of the dummy object array.- Returns:
- A dummy object array of the given size.
- Throws:
IllegalArgumentException- When the size is less than 0.
-
createIntegerArray
Creates and returns an integer array which starts at the given integer and ends at the given integer, inclusive. This is useful if you want to for example populate a<f:selectItems>which shows an integer range to represent days and years. If the begin is greater than end, then the array will be decremental. If the begin equals end, then the array will contain only one item.- Parameters:
begin- The begin integer.end- The end integer.- Returns:
- An integer array which starts at the given integer and ends at the given integer, inclusive
-
contains
Returnstrueif the string representation of an item of the given array equals to the string representation of the given item. This returnsfalseif either the array or the item is null. This is useful if you want to for example check if#{paramValues.foo}contains a certain value.- Parameters:
array- The array whose items have to be compared.item- The item to be compared.- Returns:
trueif the string representation of an item of the given array equals to the string representation of the given item.
-
reverseArray
Returns a copy of the array with items in reversed order.- Parameters:
array- The array to reverse.- Returns:
- A copy of the array with items in reversed order.
- Since:
- 2.4
-