class sap.ui.model.type.String

Control sample: sap.ui.model.type.String
Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/model/type/String
Application Component: CA-UI5-COR

This class represents the string simple type.


Constructor

Constructor for a String type.

new sap.ui.model.type.String(oFormatOptions?, oConstraints?)
Param Type Default Value Description
oFormatOptions? object

Format options; this type ignores them, since it does not support any format options

oConstraints? object

Constraints; #validateValue throws an error if any constraint is violated

maxLength? int

The maximal allowed length of the string; unlimited if not defined

minLength? int

The minimal allowed length of the string

startsWith? string

A prefix that any valid value must start with

startsWithIgnoreCase? string

A prefix that any valid value must start with, ignoring case

endsWith? string

A suffix that any valid value must end with

endsWithIgnoreCase? string

A suffix that any valid value must end with, ignoring case

contains? string

An infix that must be contained in any valid value

equals? string

The only value that is allowed

search? RegExp string

A regular expression, or a string defining a regular expression, that the value must match


Methods Overview

Method Description
sap.ui.model.type.String.extend

Creates a new subclass of class sap.ui.model.type.String 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.SimpleType.extend.

formatValue

Formats the given value to the given target type.

sap.ui.model.type.String.getMetadata

Returns a metadata object for class sap.ui.model.type.String.

parseValue

Parses the given value, which is expected to be of the given type, to a string.

validateValue

Validates whether the given value in model representation is valid and meets the defined constraints, see #constructor.

sap.ui.model.type.String.extend

Creates a new subclass of class sap.ui.model.type.String 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.SimpleType.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

formatValue

Formats the given value to the given target type.

Param Type DefaultValue Description
sValue string

The value to be formatted

sTargetType string

The target type; may be "any", "boolean", "float", "int" or "string", or a type with "any", "boolean", "float", "int" or "string" as its primitive type

sap.ui.model.type.String.getMetadata

Returns a metadata object for class sap.ui.model.type.String.

parseValue

Parses the given value, which is expected to be of the given type, to a string.

Param Type DefaultValue Description
vValue string number boolean

The value to be parsed

sSourceType string

The source type (the expected type of vValue); may be "boolean", "float", "int" or "string", or a type with "boolean", "float", "int" or "string" as its primitive type

validateValue

Validates whether the given value in model representation is valid and meets the defined constraints, see #constructor.

Param Type DefaultValue Description
sValue string

The value to be validated; null is treated like an empty string