Home
Built-in FunctionsBuilt-in Functions
Built-in functions are basically always available to the developer. In general these functions come in a number of different flavours, i.e. with differing numbers of arguments (this is because you cannot pass variable number of arguments to Java methods). Note that in future versions of JoSQL functions may be supported that allow for varying numbers of arguments (either via the use of the nasty Java 5 "..." syntax or via the use of an array), the main issue there however is that it puts the onus onto the developer then to check the arguments EVERY time the function is called which is tedious, has a direct performance impact and is potentially dangerous.

A summary of the types of built-in functions is given below. Please see the JavaDocs for full details of the built-in functions and descriptions of their operation.

TypeDescription
CollectionCollection functions operate on Collections/Maps in one way or another. For each function there tends to be a number of overloaded version (different parameter list) to provide flexibility for the developer. Also, there may be versions that have differing names to allow for developer preference however they will operate the same. Typical collection operations are: collect - get a value from a list of objects and return them as a List, sort - sort a list of objects according to their "natural" ordering, unique - for a list of objects return the "unique" set.
ConversionConversion functions convert data in one way or another, generally from one format to another. For each function there tends to be a number of overloaded version (different parameter list) to provide flexibility for the developer. Also, there may be versions that have differing names to allow for developer preference however they will operate the same. Typical conversion operations are: addTime - add an amount of time to a date and return the new Date, toNumber - convert a string to a number, upper - convert a string to uppercase.
FormattingFormatting functions format objects into a String version. For each function there tends to be a number of overloaded version (different parameter list) to provide flexibility for the developer. Also, there may be versions that have differing names to allow for developer preference however they will operate the same. Typical operations are: formatDate - format a date, formatNumber - format a number, formatTimeDuration - format a time duration.
GroupingGrouping functions perform some kind of grouping/aggregation on a collection/map. For each function there tends to be a number of overloaded version (different parameter list) to provide flexibility for the developer. Also, there may be versions that have differing names to allow for developer preference however they will operate the same. Typical grouping operations are: avg - determine the average value for the objects in a list, sum - sum the values in a list, concat - concatenate a number of strings together.
StringString functions perform operations on strings in some way. Note: whilst the regexp and rgrep functions are available for use the relevant regular expression implementation must be available for use. Typical string operations are: grep - cycle over a file, line by line and determine if any of the lines contain the specified string, subStr - return a substring of another string, trim - trim whitespace from a string.
MiscellaneousMiscellaneous functions don't really have a place anywhere else yet. Over time they probably will have a home but for now they are lumped as "Miscellaneous". For each function there tends to be a number of overloaded version (different parameter list) to provide flexibility for the developer. Also, there may be versions that have differing names to allow for developer preference however they will operate the same.
See Also