Class DefaultYmlNode
java.lang.Object
cloud.opencode.base.yml.DefaultYmlNode
Default YmlNode Implementation - Wraps raw YAML data as a node tree
默认 YmlNode 实现 - 将原始 YAML 数据包装为节点树
Features | 主要功能:
- Wrap raw YAML data as a navigable node tree - 将原始 YAML 数据包装为可导航的节点树
- Type-safe value access (int, long, boolean, double, String) - 类型安全的值访问
- Dot-notation path navigation - 点号路径导航
- Object binding via YmlBinder - 通过 YmlBinder 进行对象绑定
Usage Examples | 使用示例:
YmlNode node = DefaultYmlNode.of(data);
String name = node.get("user").get("name").asText();
int port = node.at("server.port").asInt(8080);
Security | 安全性:
- Thread-safe: No (immutable after creation, but wraps mutable data) - 线程安全: 否(创建后不可变,但包装的数据可变)
- Null-safe: Yes (returns NULL_NODE for missing keys) - 空值安全: 是(缺失键返回空节点)
- Since:
- JDK 25, opencode-base-yml V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface YmlNode
YmlNode.NodeType -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the boolean value.booleanasBoolean(boolean defaultValue) Gets the boolean value with default.doubleasDouble()Gets the double value.doubleasDouble(double defaultValue) Gets the double value with default.intasInt()Gets the integer value.intasInt(int defaultValue) Gets the integer value with default.longasLong()Gets the long value.longasLong(long defaultValue) Gets the long value with default.asText()Gets the string value.Gets the string value with default.Gets a node using dot-notation path.booleanget(int index) Gets a child node by index (for sequence nodes).Gets a child node by key (for mapping nodes).Gets the raw underlying value.getType()Gets the node type.booleanChecks if the mapping contains a key.inthashCode()iterator()keys()Gets all keys (for mapping nodes).static YmlNodenullNode()Creates a null node.static YmlNodeCreates a node from a raw value.intsize()Gets the size (for sequence or mapping nodes).toList()Converts to a List.toMap()Converts to a Map.<T> TConverts to a Java object.toString()toYaml()Converts to a YAML string.values()Gets all child nodes.Methods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface YmlNode
isMapping, isNull, isScalar, isSequence
-
Method Details
-
of
-
nullNode
-
getType
Description copied from interface:YmlNodeGets the node type. 获取节点类型。 -
asText
-
asText
-
asInt
-
asInt
-
asLong
-
asLong
-
asBoolean
-
asBoolean
-
asDouble
-
asDouble
-
get
-
get
-
at
Description copied from interface:YmlNodeGets a node using dot-notation path. 使用点号路径获取节点。 -
has
-
size
-
keys
-
values
-
toObject
-
toMap
-
toList
-
toYaml
-
getRawValue
Description copied from interface:YmlNodeGets the raw underlying value. 获取原始底层值。- Specified by:
getRawValuein interfaceYmlNode- Returns:
- the raw value | 原始值
-
iterator
-
toString
-
equals
-
hashCode
-