Sequenceablepublic class ElementName extends Object implements Sequenceable
Ability information, which uniquely identifies an ability.
You can use this class to obtain values of the fields set in an element, such as the device ID, bundle name, and ability name.
Sequenceable.Producer<T>| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static Sequenceable.Producer<ElementName> |
PRODUCER |
Creates a
ElementName instance from a Parcel. |
| 构造器 | 说明 |
|---|---|
ElementName() |
Default constructor used to create an
ElementName instance. |
ElementName(String deviceId,
String bundleName,
String abilityName) |
A parameterized constructor used to create an
ElementName instance. |
ElementName(ElementName elementName) |
A parameterized constructor used to create an
ElementName instance by copying parameters from an
existing one. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
static ElementName |
createRelative(String bundleName,
String abilityName,
String deviceId) |
Creates another
ElementName instance where the class name of the ability is prefixed with the package
name. |
boolean |
equals(Object object) |
Checks whether two
ElementName objects contain the same attributes. |
String |
getAbilityName() |
Obtains the name of an ability.
|
String |
getBundleName() |
Obtains the bundle name of an ability.
|
String |
getDeviceId() |
Obtains the unique device ID of an ability.
|
String |
getShortClassName() |
Obtains the short class name of the ability in the current
ElementName instance. |
String |
getURI() |
Obtains the URI of an ability.
|
int |
hashCode() |
Calculates the hash value of an
ElementName object. |
boolean |
marshalling(Parcel out) |
Marshals this
Sequenceable object into a Parcel. |
void |
setAbilityName(String name) |
Sets the ability name.
|
void |
setBundleName(String bundleName) |
Sets the bundle name for an ability.
|
void |
setDeviceId(String deviceId) |
Sets the device ID.
|
static ElementName |
unflattenFromString(String elementName) |
Restores an
ElementName instance from the string created using getURI(). |
boolean |
unmarshalling(Parcel in) |
Unmarshals this
Sequenceable object from a Parcel. |
hasFileDescriptorpublic static final Sequenceable.Producer<ElementName> PRODUCER
ElementName instance from a Parcel.public ElementName()
ElementName instance.public ElementName(String deviceId, String bundleName, String abilityName)
ElementName instance.deviceId - Indicates the ID of the device running the specified ability.bundleName - Indicates the name of the bundle to which the specified ability belongs.abilityName - Indicates the ability name.public ElementName(ElementName elementName)
ElementName instance by copying parameters from an
existing one.elementName - Indicates the ElementName object.public String getDeviceId()
public void setDeviceId(String deviceId)
deviceId - Indicates the device ID. An ability has only one device ID.public String getAbilityName()
public void setAbilityName(String name)
name - Indicates the name of the ability.public String getBundleName()
public void setBundleName(String bundleName)
bundleName - Indicates the bundle name for the ability.public String getURI()
The URI of an ability is determined by the deviceId, bundleName, and abilityName
attributes.
public boolean marshalling(Parcel out)
SequenceableSequenceable object into a Parcel.marshalling 在接口中 Sequenceableout - Indicates the Parcel object to which the Sequenceable
object will be marshaled..true if the marshalling is successful; returns false otherwise.Sequenceable.marshalling(Parcel)public boolean unmarshalling(Parcel in)
SequenceableSequenceable object from a Parcel.unmarshalling 在接口中 Sequenceablein - Indicates the Parcel object into which the Sequenceable
object has been marshaled.true if the unmarshalling is successful; returns false otherwise.Sequenceable.unmarshalling(Parcel)public boolean equals(Object object)
ElementName objects contain the same attributes.
ElementName contains information required for an application to query an ability.
This class contains the abilityName, bundleName, and deviceId attributes of an
application.
equals 在类中 Objectobject - Indicates the ElementName object to compare.true if the two ElementName objects contain the same attributes; returns
false otherwise.Object.hashCode(),
HashMappublic int hashCode()
ElementName object.
The hash value of an ElementName object is calculated based on the deviceId,
bundleName, and abilityName attributes.
hashCode 在类中 ObjectElementName object.Object.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)public static ElementName createRelative(String bundleName, String abilityName, String deviceId)
ElementName instance where the class name of the ability is prefixed with the package
name.bundleName - Indicates the name of the bundle to which the specified ability belongs. This parameter cannot
be null.abilityName - Indicates the class name of the ability. This parameter cannot be null.deviceId - Indicates the ID of the device running the specified ability.ElementName instance.IllegalArgumentException - Throws this exception if abilityName is null or an empty string.public String getShortClassName()
ElementName instance.
The short class name is not prefixed with the package name. Instead, it starts with a period (.),
for example, .MainAbility.
ElementName instance.public static ElementName unflattenFromString(String elementName)
ElementName instance from the string created using getURI().
The string must be in the format deviceId/bundleName/abilityName,
for example, deviceId1/com.abc.hiword/com.abc.hiword.MainAbility.
elementName - Indicates the string representing the element name, which is obtained from getURI().
This parameter cannot be null.ElementName instance.IllegalArgumentException - Throws this exception if elementName is null or is not in the
specified format.