Class sap.ui.model.odata.type.IntModule: sap/ui/model/odata/type/Int
This is an abstract base class for integer-based OData primitive types like Edm.Int16
or Edm.Int32
.
Since: 1.27.0.
Constructor Summary
Method Summary
sap.ui.model.odata.type.Int.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.model.odata.type.Int with name
sClassName
and enriches it with the information contained in oClassInfo
.sap.ui.model.odata.type.Int.getMetadata()Returns a metadata object for class sap.ui.model.odata.type.Int.
parseValue(vValue, sSourceType)Parses the given value, which is expected to be of the given source type, to an Int in number representation.
validateValue(iValue)Validates whether the given value in model representation is valid and meets the defined constraints.
Methods borrowed from class sap.ui.model.odata.type.ODataType
Methods borrowed from class sap.ui.model.Type
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.model.odata.type.Int(oFormatOptions?, oConstraints?)
Constructor for a new
Int
. Parameters:
{object} | oFormatOptions? | type-specific format options; see subtypes |
{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.Int.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.model.odata.type.Int 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.Int.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.model.odata.type.Int.
Returns:
{sap.ui.base.Metadata} | Metadata object describing this class |
formatValue(iValue, sTargetType): number|string
Formats the given value to the given target type. When formatting to
string
the format options are used. Parameters:
{number} | iValue | the value in model representation to be formatted |
{string} | sTargetType | the target type; may be "any", "int", "float" or "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 |
parseValue(vValue, sSourceType): number
Parses the given value, which is expected to be of the given source type, to an Int in number representation.
Parameters:
{number|string} | vValue | the value to be parsed. The empty string and null are parsed to null . |
{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. |
Exceptions:
{sap.ui.model.ParseException} | if sSourceType is unsupported or if the given string cannot be parsed to an integer type |
Returns:
{number} | the parsed value |
validateValue(iValue): void
Validates whether the given value in model representation is valid and meets the defined constraints.
Parameters:
{number} | iValue | the value to be validated |
Exceptions:
{sap.ui.model.ValidateException} | if the value is not in the allowed range of Int or if it is of invalid type. |