May 02, 2022
We've added several new class type utility methods to check whether an Object is a given type:
isString
isList
isMap
isArray
isSet
isIterable
Example:
$_PropertyTool.isIterable($category.selectedFieldItems)
## Expected output: true
A new List Tool method allows you to randomize the order of a List. Example:
$_ListTool.shuffle(["A","B","C"])
## Example output: [B, A, C]
A new Number Tool method allows you to test if an Object is a number. Example:
$_NumberTool.isNumeric("3")
## Expected output: true
A new Serializer Tool method allows you to convert a Map to a JSON String. Example:
#set ($a = {"test": "testing", "array": [1, 2, 3]})
$_SerializerTool.toJson($a)
## Expected output:
{"test":"testing","array":[1,2,3]}
For more information about tools and methods available in Velocity, see our Velocity Tools page.
Development |