Schemapublic class IndexData extends Object
The index data is in key-value pair format. Neither the key nor value can be null. Currently, five data types are supported: string, integer, long, double, and float.
SystemCapability.Data#DATA_SEARCH| 构造器 | 说明 |
|---|---|
IndexData() |
An no-argument constructor used to create an
IndexData instance. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
clear() |
Clears this container.
|
Object |
get(String key) |
Obtains the value matching a specified key.
|
Double |
getAsDouble(String key) |
Obtains the value matching a specified key and converts it into a double value.
|
Float |
getAsFloat(String key) |
Obtains the value matching a specified key and converts it into a float value.
|
Integer |
getAsInteger(String key) |
Obtains the value matching a specified key and converts it into an integer value.
|
Long |
getAsLong(String key) |
Obtains the value matching a specified key and converts it into a long value.
|
String |
getAsString(String key) |
Obtains the value matching a specified key and converts it into a string value.
|
Map<String,Object> |
getValues() |
Obtains a container that stores key-value pairs.
|
boolean |
isEmpty() |
Checks whether this container is empty.
|
void |
put(String key,
Double value) |
Stores a key-value pair with a string key and a double value.
|
void |
put(String key,
Float value) |
Stores a key-value pair with a string key and a float value.
|
void |
put(String key,
Integer value) |
Stores a key-value pair with a string key and an integer value.
|
void |
put(String key,
Long value) |
Stores a key-value pair with a string key and a long value.
|
void |
put(String key,
String value) |
Stores a string key-value pair.
|
void |
remove(String key) |
Deletes the key-value pair with a specified key.
|
void |
setValues(Map<String,Object> values) |
Sets a container to store key-value pairs.
|
int |
size() |
Obtains the number of key-value pairs stored in this container.
|
public IndexData()
IndexData instance.public Map<String,Object> getValues()
public void setValues(Map<String,Object> values)
values - Indicates the container to set.public int size()
public boolean isEmpty()
true if this container is empty; returns false otherwise.public void remove(String key)
key - Indicates the key of the key-value pair to delete.public void clear()
public void put(String key, String value)
key - Indicates the key to store.value - Indicates the value to store.public void put(String key, Integer value)
key - Indicates the key to store.value - Indicates the value to store.public void put(String key, Float value)
key - Indicates the key to store.value - Indicates the value to store.public void put(String key, Double value)
key - Indicates the key to store.value - Indicates the value to store.public void put(String key, Long value)
key - Indicates the key to store.value - Indicates the value to store.public Object get(String key)
key - Indicates the key to match.public String getAsString(String key)
key - Indicates the key to match.null if no value matches the specified key.public Integer getAsInteger(String key)
key - Indicates the key to match.null if no value
matches the specified key or the value found cannot be converted into an integer value.public Float getAsFloat(String key)
key - Indicates the key to match.null if no value
matches the specified key or the value found cannot be converted into a float value.public Double getAsDouble(String key)
key - Indicates the key to match.null if no value
matches the specified key or the value found cannot be converted into a double value.public Long getAsLong(String key)
key - Indicates the key to match.null if no value
matches the specified key or the value found cannot be converted into a long value.