public abstract class Element extends Object
Element based on its resource ID.
You can call a specific method of this class to obtain the resource of the specified type associated with the resource ID.
| 构造器 | 说明 |
|---|---|
Element() |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
abstract boolean |
getBoolean() |
Obtains a boolean value based on this
Element. |
abstract int |
getColor() |
Obtains a color value based on this
Element. |
abstract String |
getConfig() |
Gets a config according to a resource ID.
|
abstract float |
getFloat() |
Obtains a float value based on this
Element. |
abstract int[] |
getIntArray() |
Obtains an integer array based on this
Element. |
abstract int |
getInteger() |
Obtains an integer value based on this
Element. |
abstract Pattern |
getPattern() |
Obtains a
ohos.global.resource.solidxml.Pattern instance associated with this Element. |
abstract String |
getPluralString(int quantity) |
Obtains the string representation of plural rules associated with this
Element based on the given
quantity. |
abstract String |
getPluralString(int quantity,
Object... formatArgs) |
Obtains the string representation of plural rules associated with this
Element based on the given
quantity, and formats the string based on the specified formatted objects. |
abstract String |
getString() |
Obtains a string value based on this
Element. |
abstract String |
getString(Object... formatArgs) |
Obtains the string associated with this
Element and formats the string based on the specified formatted
objects. |
abstract String |
getString(Object[] object,
Format[] format) |
Obtains the string associated with this
Element and formats the string based on the specified format
array and object array. |
abstract String |
getString(Object object,
Format format) |
Obtains the string associated with this
Element and formats the string based on the specified format and
object. |
abstract String[] |
getStringArray() |
Obtains a string array based on this
Element. |
abstract Theme |
getTheme() |
Obtains a
Theme instance associated with this Element. |
public abstract String getString() throws IOException, NotExistException, WrongTypeException
Element.NotExistException - Throws this exception if the resource ID does not match any resources. The resource ID
must be automatically generated by the IDE or resource tool, or provided by the system.IOException - Throws this exception if an I/O error occurs during resource read.WrongTypeException - Throws this exception if the resource is not of the string type.public abstract String getString(Object... formatArgs) throws IOException, NotExistException, WrongTypeException
Element and formats the string based on the specified formatted
objects.formatArgs - Indicates the formatted objects used for substitution.NotExistException - Throws this exception if the resource ID does not match any resources. The resource ID
must be automatically generated by the IDE or resource tool, or provided by the system.IOException - Throws this exception if an I/O error occurs during resource read.WrongTypeException - Throws this exception if the resource is not of the string type.public abstract String getString(Object object, Format format) throws IOException, NotExistException, WrongTypeException
Element and formats the string based on the specified format and
object.object - Indicates the object used for substitution.format - Indicates the format used for formatting the object.NotExistException - Throws this exception if the resource ID does not match any resources. The resource ID
must be automatically generated by the IDE or resource tool, or provided by the system.IOException - Throws this exception if an I/O error occurs during resource read.WrongTypeException - Throws this exception if the resource is not of the string type.public abstract String getString(Object[] object, Format[] format) throws IOException, NotExistException, WrongTypeException
Element and formats the string based on the specified format
array and object array.object - Indicates the array of objects used for substitution.format - Indicates the array of formats used for formatting the object array. Formats and objects are in
one-to-one mapping.NotExistException - Throws this exception if the resource ID does not match any resources. The resource ID
must be automatically generated by the IDE or resource tool, or provided by the system.IOException - Throws this exception if an I/O error occurs during resource read.WrongTypeException - Throws this exception if the resource is not of the string type.public abstract boolean getBoolean()
throws IOException,
NotExistException,
WrongTypeException
Element.NotExistException - Throws this exception if the resource ID does not match any resources. The resource ID
must be automatically generated by the IDE or resource tool, or provided by the system.IOException - Throws this exception if an I/O error occurs during resource read.WrongTypeException - Throws this exception if the resource is not of the boolean type.public abstract int getColor()
throws IOException,
NotExistException,
WrongTypeException
Element.NotExistException - Throws this exception if the resource ID does not match any resources. The resource ID
must be automatically generated by the IDE or resource tool, or provided by the system.IOException - Throws this exception if an I/O error occurs during resource read.WrongTypeException - Throws this exception if the resource is not of the color type.public abstract float getFloat()
throws IOException,
NotExistException,
WrongTypeException
Element.NotExistException - Throws this exception if the resource ID does not match any resources. The resource ID
must be automatically generated by the IDE or resource tool, or provided by the system.IOException - Throws this exception if an I/O error occurs during resource read.WrongTypeException - Throws this exception if the resource is not of the float type.public abstract String getConfig() throws IOException, NotExistException, WrongTypeException
NotExistException - Throws this exception if the resource ID does not match any resources. The resource ID
must be automatically generated by the IDE or resource tool, or provided by the system.IOException - Throws this exception if an I/O error occurs during resource read.WrongTypeException - Throws this exception if the resource is not of the config type.public abstract int getInteger()
throws IOException,
NotExistException,
WrongTypeException
Element.NotExistException - Throws this exception if the resource ID does not match any resources. The resource ID
must be automatically generated by the IDE or resource tool, or provided by the system.IOException - Throws this exception if an I/O error occurs during resource read.WrongTypeException - Throws this exception if the resource is not of the integer type.public abstract String[] getStringArray() throws IOException, NotExistException, WrongTypeException
Element.NotExistException - Throws this exception if the resource ID does not match any resources. The resource ID
must be automatically generated by the IDE or resource tool, or provided by the system.IOException - Throws this exception if an I/O error occurs during resource read.WrongTypeException - Throws this exception if the resource is not of the string array type.public abstract int[] getIntArray()
throws IOException,
NotExistException,
WrongTypeException
Element.NotExistException - Throws this exception if the resource ID does not match any resources. The resource ID
must be automatically generated by the IDE or resource tool, or provided by the system.IOException - Throws this exception if an I/O error occurs during resource read.WrongTypeException - Throws this exception if the resource is not of the integer array type.public abstract String getPluralString(int quantity) throws IOException, NotExistException, WrongTypeException
Element based on the given
quantity.quantity - Indicates the number used to obtain the string representation for the current language's plural
rules.NotExistException - Throws this exception if the resource ID does not match any resources. The resource ID
must be automatically generated by the IDE or resource tool, or provided by the system.IOException - Throws this exception if an I/O error occurs during resource read.WrongTypeException - Throws this exception if the resource is not of the string type.public abstract String getPluralString(int quantity, Object... formatArgs) throws IOException, NotExistException, WrongTypeException
Element based on the given
quantity, and formats the string based on the specified formatted objects.quantity - Indicates the number used to obtain the string representation for the current language's plural
rules.formatArgs - Indicates the formatted objects used for substitution.NotExistException - Throws this exception if the resource ID does not match any resources. The resource ID
must be automatically generated by the IDE or resource tool, or provided by the system.IOException - Throws this exception if an I/O error occurs during resource read.WrongTypeException - Throws this exception if the resource is not of the string type.public abstract Theme getTheme() throws IOException, NotExistException, WrongTypeException
Theme instance associated with this Element.Theme instance.NotExistException - Throws this exception if the resource ID does not match any resources. The resource
ID must be automatically generated by the IDE or resource tool, or provided by the system.IOException - Throws this exception if an I/O error occurs during resource read.WrongTypeException - Throws this exception if the resource is not of the theme type.Themepublic abstract Pattern getPattern() throws IOException, NotExistException, WrongTypeException
ohos.global.resource.solidxml.Pattern instance associated with this Element.ohos.global.resource.solidxml.Pattern instance.NotExistException - Throws this exception if the resource ID does not match any resources. The resource ID
must be automatically generated by the IDE or resource tool, or provided by the system.IOException - Throws this exception if an I/O error occurs during resource read.WrongTypeException - Throws this exception if the resource is not of the pattern type.