class sap.ui.core.ComponentMetadata

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/core/ComponentMetadata
Application Component: CA-UI5-COR

Constructor

Creates a new metadata object for a Component subclass.

new sap.ui.core.ComponentMetadata(sClassName, oStaticInfo)
Param Type Default Value Description
sClassName string

Fully qualified name of the class that is described by this metadata object

oStaticInfo object

Static info to construct the metadata from


Methods Overview

Method Description
_applyManifest

Applies the given manifest json to the ComponentMetadata instance if there isn't already a manifest.

This method is called from - #applySettings in case there is a manifest object given from the metadata - #getManifestObject after lazy loading the manifest (sync request) - sap.ui.component / sap.ui.component.load with an existing manifest to prevent the sync request

getComponentName

Returns the name of the Component (which is the namespace only with the module name)

getComponents

Returns array of components specified in the metadata of the Component. If not specified or the array is empty, the return value is null.

Important:
If a Component is loaded using the manifest URL (or according the "manifest first" strategy), this function ignores the entries of the manifest file! It returns only the entries which have been defined in the Component metadata or in the proper Component manifest.

Since 1.27.1 Please use {@link sap.ui.core.Component#getManifestEntry}("/sap.ui5/dependencies/components")
getConfig

Returns a copy of the configuration property to disallow modifications. If no key is specified it returns the complete configuration property

Since 1.27.1 Please use {@link sap.ui.core.Component#getManifestEntry}("/sap.ui5/config")
getCustomEntry

Returns the custom Component configuration entry with the specified key (this must be a JSON object). If no key is specified, the return value is null.

Example: sap.ui.core.Component.extend("sample.Component", { metadata: { "my.custom.config" : { "property1" : true, "property2" : "Something else" } } });

The configuration above can be accessed via sample.Component.getMetadata().getCustomEntry("my.custom.config").

Since 1.27.1 Please use the sap.ui.core.ComponentMetadata#getManifestEntry
getDependencies

Returns the dependencies defined in the metadata of the Component. If not specified, the return value is null.

Important:
If a Component is loaded using the manifest URL (or according the "manifest first" strategy), this function ignores the entries of the manifest file! It returns only the entries which have been defined in the Component metadata or in the proper Component manifest.

Since 1.27.1 Please use {@link sap.ui.core.Component#getManifestEntry}("/sap.ui5/dependencies")
getIncludes

Returns the array of the included files that the Component requires such as CSS and JavaScript. If not specified or the array is empty, the return value is null.

Important:
If a Component is loaded using the manifest URL (or according the "manifest first" strategy), this function ignores the entries of the manifest file! It returns only the entries which have been defined in the Component metadata or in the proper Component manifest.

Since 1.27.1 For CSS, please use {@link sap.ui.core.Component#getManifestEntry}("/sap.ui5/resources/css").
getLibs

Returns array of libraries specified in metadata of the Component, that are automatically loaded when an instance of the component is created. If not specified or the array is empty, the return value is null.

Important:
If a Component is loaded using the manifest URL (or according the "manifest first" strategy), this function ignores the entries of the manifest file! It returns only the entries which have been defined in the Component metadata or in the proper Component manifest.

Since 1.27.1 Please use {@link sap.ui.core.Component#getManifestEntry}("/sap.ui5/dependencies/libs")
getManifest

Returns the manifest defined in the metadata of the Component. If not specified, the return value is null.

Since 1.33.0 Please use the sap.ui.core.Component#getManifest
getManifestEntry

Returns the configuration of a manifest section or the value for a specific path. If no section or key is specified, the return value is null.

Example: { "sap.ui5": { "dependencies": { "libs": { "sap.m": {} }, "components": { "my.component.a": {} } } });

The configuration above can be accessed in the following ways:

  • By section/namespace: oComponent.getMetadata().getManifestEntry("sap.ui5")
  • By path: oComponent.getMetadata().getManifestEntry("/sap.ui5/dependencies/libs")

By section/namespace returns the configuration for the specified manifest section and by path allows to specify a concrete path to a dedicated entry inside the manifest. The path syntax always starts with a slash (/).

Since 1.33.0 Please use the sap.ui.core.Component#getManifest
getManifestObject

Returns the manifest object.

getMetadataVersion

Returns the version of the metadata which could be 1 or 2. 1 is for legacy metadata whereas 2 is for the manifest.

getRawManifest

Returns the raw manifest defined in the metadata of the Component. If not specified, the return value is null.

Since 1.33.0 Please use the sap.ui.core.Component#getManifest
getUI5Version

Returns the required version of SAPUI5 defined in the metadata of the Component. If returned value is null, then no special UI5 version is required.

Important:
If a Component is loaded using the manifest URL (or according the "manifest first" strategy), this function ignores the entries of the manifest file! It returns only the entries which have been defined in the Component metadata or in the proper Component manifest.

Since 1.27.1 Please use {@link sap.ui.core.Component#getManifestEntry}("/sap.ui5/dependencies/minUI5Version")
getVersion

Returns the version of the component. If not specified, the return value is null.

Important:
If a Component is loaded using the manifest URL (or according the "manifest first" strategy), this function ignores the entries of the manifest file! It returns only the entries which have been defined in the Component metadata or in the proper Component manifest.

Since 1.34.2 Please use {@link sap.ui.core.Component#getManifestEntry}("/sap.app/applicationVersion/version")
isBaseClass

Returns whether the class of this metadata is a component base class or not.

_applyManifest

Applies the given manifest json to the ComponentMetadata instance if there isn't already a manifest.

This method is called from - #applySettings in case there is a manifest object given from the metadata - #getManifestObject after lazy loading the manifest (sync request) - sap.ui.component / sap.ui.component.load with an existing manifest to prevent the sync request

Param Type DefaultValue Description
oManifestJson object

manifest object (will be modified internally!)

getComponentName

Returns the name of the Component (which is the namespace only with the module name)

getComponents

Returns array of components specified in the metadata of the Component. If not specified or the array is empty, the return value is null.

Important:
If a Component is loaded using the manifest URL (or according the "manifest first" strategy), this function ignores the entries of the manifest file! It returns only the entries which have been defined in the Component metadata or in the proper Component manifest.

Since 1.27.1 Please use {@link sap.ui.core.Component#getManifestEntry}("/sap.ui5/dependencies/components")

getConfig

Returns a copy of the configuration property to disallow modifications. If no key is specified it returns the complete configuration property

Since 1.27.1 Please use {@link sap.ui.core.Component#getManifestEntry}("/sap.ui5/config")
Param Type DefaultValue Description
sKey string

Key of the configuration property

bDoNotMerge boolean false

If set to true, only the local configuration is returned

getCustomEntry

Returns the custom Component configuration entry with the specified key (this must be a JSON object). If no key is specified, the return value is null.

Example: sap.ui.core.Component.extend("sample.Component", { metadata: { "my.custom.config" : { "property1" : true, "property2" : "Something else" } } });

The configuration above can be accessed via sample.Component.getMetadata().getCustomEntry("my.custom.config").

Since 1.27.1 Please use the sap.ui.core.ComponentMetadata#getManifestEntry
Param Type DefaultValue Description
sKey string

Key of the custom configuration (must be prefixed with a namespace)

bMerged boolean false

Indicates whether the custom configuration is merged with the parent custom configuration of the Component.

getDependencies

Returns the dependencies defined in the metadata of the Component. If not specified, the return value is null.

Important:
If a Component is loaded using the manifest URL (or according the "manifest first" strategy), this function ignores the entries of the manifest file! It returns only the entries which have been defined in the Component metadata or in the proper Component manifest.

Since 1.27.1 Please use {@link sap.ui.core.Component#getManifestEntry}("/sap.ui5/dependencies")

getIncludes

Returns the array of the included files that the Component requires such as CSS and JavaScript. If not specified or the array is empty, the return value is null.

Important:
If a Component is loaded using the manifest URL (or according the "manifest first" strategy), this function ignores the entries of the manifest file! It returns only the entries which have been defined in the Component metadata or in the proper Component manifest.

Since 1.27.1 For CSS, please use {@link sap.ui.core.Component#getManifestEntry}("/sap.ui5/resources/css").

getLibs

Returns array of libraries specified in metadata of the Component, that are automatically loaded when an instance of the component is created. If not specified or the array is empty, the return value is null.

Important:
If a Component is loaded using the manifest URL (or according the "manifest first" strategy), this function ignores the entries of the manifest file! It returns only the entries which have been defined in the Component metadata or in the proper Component manifest.

Since 1.27.1 Please use {@link sap.ui.core.Component#getManifestEntry}("/sap.ui5/dependencies/libs")

getManifest

Returns the manifest defined in the metadata of the Component. If not specified, the return value is null.

Since 1.33.0 Please use the sap.ui.core.Component#getManifest

getManifestEntry

Returns the configuration of a manifest section or the value for a specific path. If no section or key is specified, the return value is null.

Example: { "sap.ui5": { "dependencies": { "libs": { "sap.m": {} }, "components": { "my.component.a": {} } } });

The configuration above can be accessed in the following ways:

By section/namespace returns the configuration for the specified manifest section and by path allows to specify a concrete path to a dedicated entry inside the manifest. The path syntax always starts with a slash (/).

Since 1.33.0 Please use the sap.ui.core.Component#getManifest
Param Type DefaultValue Description
sKey string

Either the manifest section name (namespace) or a concrete path

bMerged boolean false

Indicates whether the custom configuration is merged with the parent custom configuration of the Component.

getManifestObject

Returns the manifest object.

getMetadataVersion

Returns the version of the metadata which could be 1 or 2. 1 is for legacy metadata whereas 2 is for the manifest.

getRawManifest

Returns the raw manifest defined in the metadata of the Component. If not specified, the return value is null.

Since 1.33.0 Please use the sap.ui.core.Component#getManifest

getUI5Version

Returns the required version of SAPUI5 defined in the metadata of the Component. If returned value is null, then no special UI5 version is required.

Important:
If a Component is loaded using the manifest URL (or according the "manifest first" strategy), this function ignores the entries of the manifest file! It returns only the entries which have been defined in the Component metadata or in the proper Component manifest.

Since 1.27.1 Please use {@link sap.ui.core.Component#getManifestEntry}("/sap.ui5/dependencies/minUI5Version")

getVersion

Returns the version of the component. If not specified, the return value is null.

Important:
If a Component is loaded using the manifest URL (or according the "manifest first" strategy), this function ignores the entries of the manifest file! It returns only the entries which have been defined in the Component metadata or in the proper Component manifest.

Since 1.34.2 Please use {@link sap.ui.core.Component#getManifestEntry}("/sap.app/applicationVersion/version")

isBaseClass

Returns whether the class of this metadata is a component base class or not.