Class sap.ui.model.odata.type.BooleanModule: sap/ui/model/odata/type/Boolean
This class represents the OData primitive type Edm.Boolean
.
In both sap.ui.model.odata.v2.ODataModel and sap.ui.model.odata.v4.ODataModel this type is represented as a boolean
.
Since: 1.27.0.
Constructor Summary
new sap.ui.model.odata.type.Boolean(oFormatOptions?, oConstraints?)Constructor for an OData primitive type
Edm.Boolean
.Method Summary
sap.ui.model.odata.type.Boolean.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.model.odata.type.Boolean with name
sClassName
and enriches it with the information contained in oClassInfo
.sap.ui.model.odata.type.Boolean.getMetadata()Returns a metadata object for class sap.ui.model.odata.type.Boolean.
validateValue(bValue)Validates whether the given value in model representation is valid and meets the given constraints.
Methods borrowed from class sap.ui.model.odata.type.ODataType
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.model.odata.type.Boolean(oFormatOptions?, oConstraints?)
Constructor for an OData primitive type
Edm.Boolean
. Parameters:
{object} | oFormatOptions? | format options as defined in the interface of sap.ui.model.SimpleType; this type ignores them since it does not support any format options |
{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.Boolean.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.model.odata.type.Boolean 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.Boolean.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.model.odata.type.Boolean.
Returns:
{sap.ui.base.Metadata} | Metadata object describing this class |
formatValue(bValue, sTargetType): boolean|string
Formats the given boolean value to the given target type.
Parameters:
{boolean} | bValue | the value to be formatted |
{string} | sTargetType | the target type; may be "any", "boolean" or "string". If it is "string", the result is "Yes" or "No" in the current language. See sap.ui.model.odata.type for more information. |
Exceptions:
{sap.ui.model.FormatException} | if sTargetType is unsupported |
Returns:
{boolean|string} | the formatted output value in the target type; undefined or null are formatted to null |
parseValue(vValue, sSourceType): boolean
Parses the given value from the given type to a boolean.
Parameters:
{boolean|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 "boolean" 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 is neither "Yes" nor "No" in the current language. |
Returns:
{boolean} | the parsed value |
validateValue(bValue): void
Validates whether the given value in model representation is valid and meets the given constraints.
Parameters:
{boolean} | bValue | the value to be validated |
Exceptions:
{sap.ui.model.ValidateException} | if the value is not valid |