Class sap.ui.model.odata.type.SingleModule: sap/ui/model/odata/type/Single

extends ODataType

This class represents the OData primitive type Edm.Single.

In both sap.ui.model.odata.v2.ODataModel and sap.ui.model.odata.v4.ODataModel this type is represented as a number.


Since: 1.27.1.
Constructor Summary
new sap.ui.model.odata.type.Single(oFormatOptions?, oConstraints?)Constructor for a primitive type Edm.Single.
Method Summary
sap.ui.model.odata.type.Single.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.model.odata.type.Single with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.model.odata.type.Single.getMetadata()Returns a metadata object for class sap.ui.model.odata.type.Single.
formatValue(vValue, sTargetType)Formats the given value to the given target type.
getName()Returns the type's name.
parseValue(vValue, sSourceType)Parses the given value, which is expected to be of the given type, to an Edm.Single in number representation.
validateValue(fValue)Validates whether the given value in model representation is valid and meets the defined constraints.
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.model.odata.type.Single(oFormatOptions?, oConstraints?)
Constructor for a primitive type Edm.Single.
Parameters:
{object}oFormatOptions? format options as defined in sap.ui.core.format.NumberFormat. In contrast to NumberFormat groupingEnabled defaults to true.
{object}oConstraints? constraints; validateValue throws an error if any constraint is violated
{boolean|string}oConstraints.nullable?, Default: true if true, the value null is accepted
Method Detail
sap.ui.model.odata.type.Single.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.model.odata.type.Single 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.odata.type.ODataType.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.odata.type.Single.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.model.odata.type.Single.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
formatValue(vValue, sTargetType): number|string
Formats the given value to the given target type.
Parameters:
{string|number}vValue the value to be formatted, which is represented as a number in the model
{string}sTargetType the target type; may be "any", "float", "int", "string". See sap.ui.model.odata.type for more information.
Exceptions:
{sap.ui.model.FormatException} if sTargetType is unsupported
Returns:
{number|string} the formatted output value in the target type; undefined or null are formatted to null
getName(): string
Returns the type's name.
Returns:
{string} the type's name
parseValue(vValue, sSourceType): number
Parses the given value, which is expected to be of the given type, to an Edm.Single in number representation.
Parameters:
{string|number}vValue the value to be parsed; the empty string and null are parsed to null; note that there is no way to enter Infinity or NaN values
{string}sSourceType the source type (the expected type of vValue); may be "float", "int" or "string". See sap.ui.model.odata.type for more information.
Since:
1.29.0
Exceptions:
{sap.ui.model.ParseException} if sSourceType is unsupported or if the given string cannot be parsed to a Single
Returns:
{number} the parsed value
validateValue(fValue): void
Validates whether the given value in model representation is valid and meets the defined constraints.
Parameters:
{number}fValue the value to be validated
Since:
1.29.0
Exceptions:
{sap.ui.model.ValidateException} if the value is not valid