ohos.element_name
Note:
Currently in the beta phase.
This module describes the ElementName information.
Import Module
import kit.AbilityKit.*
class ElementName
public class ElementName {
public var deviceId: String
public var bundleName: String
public var abilityName: String
public var moduleName: String
public init(bundleName: String, abilityName: String, deviceId!: String = "", moduleName!: String = "")
}
Description: ElementName information.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
var abilityName
public var abilityName: String
Description: Ability name.
Type: String
Readable/Writable: Readable and Writable
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
var bundleName
public var bundleName: String
Description: Application bundle name.
Type: String
Readable/Writable: Readable and Writable
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
var deviceId
public var deviceId: String
Description: Device ID.
Type: String
Readable/Writable: Readable and Writable
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
var moduleName
public var moduleName: String
Description: Module name of the HAP to which the Ability belongs.
Type: String
Readable/Writable: Readable and Writable
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
init(String, String, String, String)
public init(bundleName: String, abilityName: String, deviceId!: String = "", moduleName!: String = "")
Description: Constructs an ElementName by specifying the device ID, application bundle name, Ability name, and module name.
System Capability: SystemCapability.BundleManager.BundleFramework.Core
Since: 22
Parameters:
| Name | Type | Mandatory | Default Value | Description |
|---|---|---|---|---|
| bundleName | String | Yes | - | Application bundle name. |
| abilityName | String | Yes | - | Ability name. |
| deviceId | String | No | "" | Device ID. |
| moduleName | String | No | "" | Module name of the HAP to which the Ability belongs. |
Example:
import kit.AbilityKit.*
import ohos.business_exception.BusinessException
import kit.PerformanceAnalysisKit.Hilog
try {
let elementName = ElementName("com.ohos.example", "com.ohos.example.MainAbility");
} catch (e: BusinessException) {
Hilog.info(0, "test", "${e.message}")
}