public class FieldNode extends Object
Schema instance.
Through the Schema instance, you can define the fields contained in the values stored in a database.
A FieldNode of the Schema instance is either a leaf or a non-leaf node.
The leaf node must have a value; the non-leaf node must have a child FieldNode.
SystemCapability.Data#DATA_DISTRIBUTEDDATAMGR| 构造器 | 说明 |
|---|---|
FieldNode(String fieldName) |
A constructor used to create a
FieldNode instance with the specified field. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
boolean |
appendChild(FieldNode fieldNode) |
Adds a child node to this
FieldNode. |
List<FieldNode> |
getChildren() |
Obtains the list of child nodes of this
FieldNode. |
Object |
getDefaultValue() |
Obtains the default field value.
|
String |
getFieldName() |
Obtains the field name.
|
FieldValueType |
getType() |
Obtains the field value type.
|
boolean |
isNullable() |
Checks whether field value is nullable.
|
boolean |
setDefault(boolean defaultValue) |
Sets the default boolean field value.
|
boolean |
setDefault(double defaultValue) |
Set the default double value of this field value.
|
boolean |
setDefault(int defaultValue) |
Sets the default int field value.
|
boolean |
setDefault(long defaultValue) |
Sets the default long field value.
|
boolean |
setDefault(String defaultValue) |
Sets the default string field value.
|
boolean |
setDefaultNull() |
Sets the default field value to null.
|
boolean |
setNullable(boolean isNullable) |
Sets whether field value is nullable.
|
void |
setType(FieldValueType type) |
Sets the field value type.
|
public FieldNode(String fieldName)
FieldNode instance with the specified field.
The initialized FieldNode instance contains no value or child node.
fieldName - Indicates the field name.public String getFieldName()
public boolean appendChild(FieldNode fieldNode)
FieldNode.
Adding a child node makes this node a non-leaf node. Field value will be ignored if it has child node.
fieldNode - The field node to append.true if the child node is successfully added to this FieldNode;
returns false otherwise.public List<FieldNode> getChildren()
FieldNode.
This method only applies to non-leaf nodes.
FieldNode.public FieldValueType getType()
public void setType(FieldValueType type)
type - Indicates the field value type to set.public boolean isNullable()
true if field value is nullable; returns false otherwise.public boolean setNullable(boolean isNullable)
isNullable - Specifies whether field value is nullable.
Value true indicates that field value is nullable, and value false indicates not.true if set successfully; returns false otherwise.public Object getDefaultValue()
public boolean setDefault(String defaultValue)
defaultValue - Indicates the default string field value to set.true if the default string field value is set successfully;
returns false otherwise.public boolean setDefault(int defaultValue)
defaultValue - Indicates the default int field value to set.true if the default int field value is set successfully;
returns false otherwise.public boolean setDefault(long defaultValue)
defaultValue - Indicates the default long field value to set.true if the default long field value is set successfully;
returns false otherwise.public boolean setDefault(double defaultValue)
defaultValue - default valuepublic boolean setDefault(boolean defaultValue)
defaultValue - Indicates the default boolean field value to set.true if the default boolean field value is set successfully;
returns false otherwise.public boolean setDefaultNull()
true if the default boolean field value is set successfully;
returns false otherwise.