Class sap.ui.model.type.CurrencyModule: sap/ui/model/type/Currency
This class represents the currency composite type.
Constructor Summary
Method Summary
sap.ui.model.type.Currency.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.model.type.Currency with name
sClassName
and enriches it with the information contained in oClassInfo
.sap.ui.model.type.Currency.getMetadata()Returns a metadata object for class sap.ui.model.type.Currency.
formatValue(vValue, sInternalType)Format the given array containing amount and currency code to an output value of type string.
parseValue(vValue, sInternalType, aCurrentValues)Parse a string value to an array containing amount and currency.
Methods borrowed from class sap.ui.model.CompositeType
Methods borrowed from class sap.ui.model.Type
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.model.type.Currency(oFormatOptions?, oConstraints?)
Constructor for a Currency type.
Parameters:
{object} | oFormatOptions? | formatting options. Supports the same options as NumberFormat.getCurrencyInstance |
{object} | oFormatOptions.source? | additional set of format options to be used if the property in the model is not of type string and needs formatting as well. In case an empty object is given, the default is disabled grouping and a dot as decimal separator. |
{object} | oConstraints? | value constraints. |
{float} | oConstraints.minimum? | smallest value allowed for this type |
{float} | oConstraints.maximum? | largest value allowed for this type |
Method Detail
sap.ui.model.type.Currency.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.model.type.Currency with name
sClassName
and enriches it with the information contained in oClassInfo
. oClassInfo
might contain the same kind of information as described in sap.ui.model.CompositeType.extend.
Parameters:
{string} | sClassName | Name of the class being created |
{object} | oClassInfo? | Object literal with information about the class |
{function} | FNMetaImpl? | Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata |
Returns:
{function} | Created class / constructor function |
sap.ui.model.type.Currency.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.model.type.Currency.
Returns:
{sap.ui.base.Metadata} | Metadata object describing this class |
formatValue(vValue, sInternalType): any
Format the given array containing amount and currency code to an output value of type string. Other internal types than 'string' are not supported by the Currency type. If an source format is has been defined for this type, the formatValue does also accept a string value as input, which will be parsed into an array using the source format. If aValues is not defined or null, null will be returned.
Parameters:
{array|string} | vValue | the array of values or string value to be formatted |
{string} | sInternalType | the target type |
Returns:
{any} | the formatted output value |
parseValue(vValue, sInternalType, aCurrentValues): array|string
Parse a string value to an array containing amount and currency. Parsing of other internal types than 'string' is not supported by the Currency type. In case a source format has been defined, after parsing the currency is formatted using the source format and a string value is returned instead.
Parameters:
{any} | vValue | the value to be parsed |
{string} | sInternalType | the source type |
{array} | aCurrentValues | the current values of all binding parts |
Returns:
{array|string} | the parse result array |