Base class for all SAPUI5 Objects.
Method | Description |
---|---|
sap.ui.base.Object.defineClass |
Creates metadata for a given class and attaches it to the constructor and prototype of that class. After creation, metadata can be retrieved with getMetadata(). The static info can at least contain the following entries:
Since 1.3.1 Use the static <code>extend</code> method of the desired base class (e.g. {@link sap.ui.base.Object.extend})
|
destroy |
Destructor method for objects. |
sap.ui.base.Object.extend |
Creates a subclass of class sap.ui.base.Object with name
The prototype object of the newly created class uses the same prototype as instances of the base class (prototype chaining). A metadata object is always created, even if there is no Last but not least, with the third argument |
getInterface |
Returns the public facade of this object. By default, the public facade is implemented as an instance of sap.ui.base.Interface, exposing the See the documentation of the extend method for an explanation of The facade is created on the first call of |
getMetadata |
Returns the metadata for the class that this object belongs to. This method is only defined when metadata has been declared by using sap.ui.base.Object.defineClass or sap.ui.base.Object.extend. |
isA |
Checks whether this object is an instance of the named type. This check is solely based on the type names as declared in the class metadata. It compares the given Instead of a single type name, an array of type names can be given and the method will check if this object is an instance of any of the listed types (logical or). Should the UI5 class system in future implement additional means of associating classes with type names (e.g. by introducing mixins), then this method might detect matches for those names as well. |
sap.ui.base.Object.isA |
Checks whether the given object is an instance of the named type. This function is a short-hand convenience for sap.ui.base.Object#isA. Please see the API documentation of sap.ui.base.Object#isA for more details. |
Creates metadata for a given class and attaches it to the constructor and prototype of that class.
After creation, metadata can be retrieved with getMetadata().
The static info can at least contain the following entries:
Param | Type | DefaultValue | Description |
---|---|---|---|
sClassName | string |
name of an (already declared) constructor function |
|
oStaticInfo | object |
static info used to create the metadata object |
|
baseType | string |
qualified name of a base class |
|
publicMethods | string[] |
array of names of public methods |
|
FNMetaImpl | function |
constructor function for the metadata object. If not given, it defaults to sap.ui.base.Metadata. |
Creates a subclass of class sap.ui.base.Object with name sClassName
and enriches it with the information contained in oClassInfo
.
oClassInfo
might contain three kinds of information:
metadata:
an (optional) object literal with metadata about the class. The information in the object literal will be wrapped by an instance of Metadata and might contain the following information interfaces:
{string[]} (optional) set of names of implemented interfaces (defaults to no interfaces)publicMethods:
{string[]} (optional) list of methods that should be part of the public facade of the classabstract:
{boolean} (optional) flag that marks the class as abstract (purely informational, defaults to false)final:
{boolean} (optional) flag that marks the class as final (defaults to false)constructor:
a function that serves as a constructor function for the new class. If no constructor function is given, the framework creates a default implementation that delegates all its arguments to the constructor function of the base class. oClassInfo
is copied into the prototype object of the newly created class. Callers can thereby add methods or properties to all instances of the class. But be aware that the given values are shared between all instances of the class. Usually, it doesn't make sense to use primitive values here other than to declare public constants.If such a property has a function as its value, and if the property name does not start with an underscore or with the prefix "on", the property name will be automatically added to the list of public methods of the class (see property publicMethods
in the metadata
section). If a method's name matches that pattern, but is not meant to be public, it shouldn't be included in the class info object, but be assigned to the prototype instead.
The prototype object of the newly created class uses the same prototype as instances of the base class (prototype chaining).
A metadata object is always created, even if there is no metadata
entry in the oClassInfo
object. A getter for the metadata is always attached to the prototype and to the class (constructor function) itself.
Last but not least, with the third argument FNMetaImpl
the constructor of a metadata class can be specified. Instances of that class will be used to represent metadata for the newly created class and for any subclass created from it. Typically, only frameworks will use this parameter to enrich the metadata for a new class hierarchy they introduce (e.g. Element).
Param | Type | DefaultValue | Description |
---|---|---|---|
sClassName | string |
name of the class to be created |
|
oClassInfo | object |
structured object with information about the class |
|
FNMetaImpl | function |
constructor function for the metadata object. If not given, it defaults to sap.ui.base.Metadata. |
Returns the public facade of this object.
By default, the public facade is implemented as an instance of sap.ui.base.Interface, exposing the publicMethods
as defined in the metadata of the class of this object.
See the documentation of the extend method for an explanation of publicMethods
.
The facade is created on the first call of getInterface
and reused for all later calls.
Returns the metadata for the class that this object belongs to.
This method is only defined when metadata has been declared by using sap.ui.base.Object.defineClass or sap.ui.base.Object.extend.
Checks whether this object is an instance of the named type.
This check is solely based on the type names as declared in the class metadata. It compares the given vTypeName
with the name of the class of this object, with the names of any base class of that class and with the names of all interfaces implemented by any of the aforementioned classes.
Instead of a single type name, an array of type names can be given and the method will check if this object is an instance of any of the listed types (logical or).
Should the UI5 class system in future implement additional means of associating classes with type names (e.g. by introducing mixins), then this method might detect matches for those names as well.
Param | Type | DefaultValue | Description |
---|---|---|---|
vTypeName | string string[] |
Type or types to check for |
Checks whether the given object is an instance of the named type. This function is a short-hand convenience for sap.ui.base.Object#isA.
Please see the API documentation of sap.ui.base.Object#isA for more details.
Param | Type | DefaultValue | Description |
---|---|---|---|
oObject | object |
Object which will be checked whether it is an instance of the given type |
|
vTypeName | string string[] |
Type or types to check for |