Abstract Class sap.ui.base.ObjectModule: sap/ui/base/Object
Base class for all SAPUI5 Objects
sClassName
and enriches it with the information contained in oClassInfo
.sClassName
and enriches it with the information contained in oClassInfo
. oClassInfo
might contain three kinds of informations:
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 informationinterfaces:
{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.- any-other-name: any other property in the
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.
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).
{string} | sClassName | name of the class to be created |
{object} | oClassInfo? | structured object with informations about the class |
{function} | FNMetaImpl? | constructor function for the metadata object. If not given, it defaults to sap.ui.base.Metadata. |
- Since:
- 1.3.1
{function} | the created class / constructor function |
{sap.ui.base.Interface} | the public interface of the object |
This method is only defined when metadata has been declared by using sap.ui.base.Object.defineClass or sap.ui.base.Object.extend.
After creation, metadata can be retrieved with getMetadata().
The static info can at least contain the following entries:
- baseType: {string} fully qualified name of a base class or empty
- publicMethods: {string} an array of method names that will be visible in the interface proxy returned by getInterface
{string} | sClassName | name of an (already declared) constructor function |
{object} | oStaticInfo | static info used to create the metadata object |
{string} | oStaticInfo.baseType | qualified name of a base class |
{string[]} | oStaticInfo.publicMethods | array of names of public methods |
{function} | FNMetaImpl? | constructor function for the metadata object. If not given, it defaults to sap.ui.base.Metadata. |
- Deprecated:
- Since 1.3.1. Use the static
extend
method of the desired base class (e.g. sap.ui.base.Object.extend)
{sap.ui.base.Metadata} | the created metadata object |