Class sap.ui.core.ComponentMetadataModule: sap/ui/core/ComponentMetadata



Since: 1.9.2.
Constructor Summary
new sap.ui.core.ComponentMetadata(sClassName, oStaticInfo)Creates a new metadata object for a Component subclass.
Method Summary
getComponentName()Returns the name of the Component (which is the namespace only with the module name)
getManifestObject()Returns the manifest object.
getMetadataVersion()Returns the version of the metadata which could be 1 or 2.
isBaseClass()Returns whether the class of this metadata is a component base class or not.
getComponents()Returns array of components specified in the metadata of the Component.
getConfig(sKey?, bDoNotMerge?)Returns a copy of the configuration property to disallow modifications.
getCustomEntry(sKey, bMerged)Returns the custom Component configuration entry with the specified key (this must be a JSON object).
getDependencies()Returns the dependencies defined in the metadata of the Component.
getIncludes()Returns the array of the included files that the Component requires such as CSS and JavaScript.
getLibs()Returns array of libraries specified in metadata of the Component, that are automatically loaded when an instance of the component is created.
getManifest()Returns the manifest defined in the metadata of the Component.
getManifestEntry(sKey, bMerged?)Returns the configuration of a manifest section or the value for a specific path.
getRawManifest()Returns the raw manifest defined in the metadata of the Component.
getUI5Version()Returns the required version of SAPUI5 defined in the metadata of the Component.
getVersion()Returns the version of the component.
Constructor Detail
new sap.ui.core.ComponentMetadata(sClassName, oStaticInfo)
Creates a new metadata object for a Component subclass.
Parameters:
{string}sClassName Fully qualified name of the class that is described by this metadata object
{object}oStaticInfo Static info to construct the metadata from
Method Detail
getComponentName(): string
Returns the name of the Component (which is the namespace only with the module name)
Returns:
{string} Component name
getManifestObject(): sap.ui.core.Manifest
Returns the manifest object.
Since:
1.33.0
Returns:
{sap.ui.core.Manifest} manifest.
getMetadataVersion(): int
Returns the version of the metadata which could be 1 or 2. 1 is for legacy metadata whereas 2 is for the manifest.
Since:
1.27.1
Returns:
{int} metadata version (1: legacy metadata, 2: manifest)
isBaseClass(): boolean
Returns whether the class of this metadata is a component base class or not.
Since:
1.33.0
Returns:
{boolean} true if it is sap.ui.core.Component or sap.ui.core.UIComponent
getComponents(): string[]
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.

Deprecated:
Since 1.27.1. Please use sap.ui.core.Component#getManifestEntry("/sap.ui5/dependencies/components")
Returns:
{string[]} Required Components.
getConfig(sKey?, bDoNotMerge?): object
Returns a copy of the configuration property to disallow modifications. If no key is specified it returns the complete configuration property
Parameters:
{string}sKey? Key of the configuration property
{boolean}bDoNotMerge? If set to true, only the local configuration is returned
Deprecated:
Since 1.27.1. Please use sap.ui.core.Component#getManifestEntry("/sap.ui5/config")
Since:
1.15.1
Returns:
{object} the value of the configuration property
getCustomEntry(sKey, bMerged): Object
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").

Parameters:
{string}sKey Key of the custom configuration (must be prefixed with a namespace)
{boolean}bMerged Indicates whether the custom configuration is merged with the parent custom configuration of the Component.
Deprecated:
Since 1.27.1. Please use the sap.ui.core.ComponentMetadata#getManifestEntry
Returns:
{Object} custom Component configuration with the specified key.
getDependencies(): Object
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.

Deprecated:
Since 1.27.1. Please use sap.ui.core.Component#getManifestEntry("/sap.ui5/dependencies")
Returns:
{Object} Component dependencies.
getIncludes(): string[]
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.

Deprecated:
Since 1.27.1. Please use sap.ui.core.Component#getManifestEntry("/sap.ui5/resources")
Returns:
{string[]} Included files.
getLibs(): string[]
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.

Deprecated:
Since 1.27.1. Please use sap.ui.core.Component#getManifestEntry("/sap.ui5/dependencies/libs")
Returns:
{string[]} Required libraries.
getManifest(): Object
Returns the manifest defined in the metadata of the Component. If not specified, the return value is null.
Deprecated:
Since 1.33.0. Please use the sap.ui.core.Component#getManifest
Since:
1.27.1
Returns:
{Object} manifest.
getManifestEntry(sKey, bMerged?): any|null
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 (/).

Parameters:
{string}sKey Either the manifest section name (namespace) or a concrete path
{boolean}bMerged? Indicates whether the custom configuration is merged with the parent custom configuration of the Component.
Deprecated:
Since 1.33.0. Please use the sap.ui.core.Component#getManifest
Since:
1.27.1
Returns:
{any|null} Value of the manifest section or the key (could be any kind of value)
getRawManifest(): Object
Returns the raw manifest defined in the metadata of the Component. If not specified, the return value is null.
Deprecated:
Since 1.33.0. Please use the sap.ui.core.Component#getManifest
Since:
1.29.0
Returns:
{Object} manifest
getUI5Version(): string
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.

Deprecated:
Since 1.27.1. Please use sap.ui.core.Component#getManifestEntry("/sap.ui5/dependencies/minUI5Version")
Returns:
{string} Required version of UI5 or if not specified then null.
getVersion(): string
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.

Deprecated:
Since 1.34.2. Please use sap.ui.core.Component#getManifestEntry("/sap.app/applicationVersion/version")
Returns:
{string} The version of the component.