Enforcer provides the following cateogries of functions accessible from ALFA. These functions can be used as part of an expression inside a policy.
- String Functions
- Attribute Bag Functions
- Time Functions
- Logical Functions
- Arithmetic Functions
- Conversion Functions
To make use of these functions from inside an ALFA file, use the import statement:
import Oasis.Functions
import Enforcer.Functions
Conversion Functions
The following conversion functions exist:
See also: String Functions for conversion functions between strings and all other types.
To Money from Double
Namespace : Oasis.Functions
function ToMoneyFromDouble = "urn:rsk:function:money-from-double" : toConvert:double -> money
Takes a double value and converts to money. There is no implicit conversion between these numeric types, unlike integer and money.
Example
The following function would return 7.3:money
.
ToMoneyFromDouble(7.3)
To Double from Money
Namespace : Oasis.Functions
function ToDoubleFromMoney = "urn:rsk:function:double-from-money" : toConvert:money -> double
Takes a money value and converts to double. There is no implicit conversion between these numeric types, unlike integer and money.
Example
The following function would return 7.3.
ToDoubleFromMoney(7.3:m)