本文整理了Java中io.helidon.config.Config.type()
方法的一些代码示例,展示了Config.type()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.type()
方法的具体详情如下:
包路径:io.helidon.config.Config
类名称:Config
方法名:type
[英]Provides the Type of the Config node.
[中]提供配置节点的类型。
代码示例来源:origin: oracle/helidon
/**
* Returns {@code true} if the node exists, whether an object, a list, or a
* value node.
*
* @return {@code true} if the node exists
*/
default boolean exists() {
return type().exists();
}
代码示例来源:origin: oracle/helidon
/**
* Returns {@code true} if this node exists and is a leaf node (has no
* children).
* <p>
* A leaf node has no nested configuration subtree and has a single value.
*
* @return {@code true} if the node is existing leaf node, {@code false}
* otherwise.
*/
default boolean isLeaf() {
return type().isLeaf();
}
代码示例来源:origin: oracle/helidon
private static boolean notEqual(Config left, Config right) {
if (left.type() != right.type()) {
return true;
}
if (left.isLeaf()) {
return !value(left).equals(value(right));
}
return false;
}
代码示例来源:origin: oracle/helidon
@Override
public OptionalInt apply(Config config) throws ConfigMappingException, MissingValueException {
if (config.type() == Config.Type.MISSING) {
return OptionalInt.empty();
}
return OptionalInt.of(Integer.parseInt(config.asString().get()) - 1);
}
代码示例来源:origin: oracle/helidon
private Stream<Config> traverseSubNodes(Config config, Predicate<Config> predicate) {
if (config.type().isLeaf()) {
return Stream.of(config);
} else {
return config.asNodeList()
.map(list -> list.stream()
.filter(predicate)
.map(node -> traverseSubNodes(node, predicate))
.reduce(Stream.of(config), Stream::concat))
.orElseThrow(MissingValueException.createSupplier(key()));
}
}
代码示例来源:origin: io.helidon.config/helidon-config
/**
* Returns {@code true} if this node exists and is a leaf node (has no
* children).
* <p>
* A leaf node has no nested configuration subtree and has a single value.
*
* @return {@code true} if the node is existing leaf node, {@code false}
* otherwise.
*/
default boolean isLeaf() {
return type().isLeaf();
}
代码示例来源:origin: io.helidon.config/helidon-config
/**
* Returns {@code true} if the node exists, whether an object, a list, or a
* value node.
*
* @return {@code true} if the node exists
*/
default boolean exists() {
return type().exists();
}
代码示例来源:origin: io.helidon.config/helidon-config
private static boolean notEqual(Config left, Config right) {
if (left.type() != right.type()) {
return true;
}
if (left.isLeaf()) {
return !value(left).equals(value(right));
}
return false;
}
代码示例来源:origin: io.helidon.config/helidon-config
private Stream<Config> traverseSubNodes(Config config, Predicate<Config> predicate) {
if (config.type().isLeaf()) {
return Stream.of(config);
} else {
return config.asNodeList()
.map(list -> list.stream()
.filter(predicate)
.map(node -> traverseSubNodes(node, predicate))
.reduce(Stream.of(config), Stream::concat))
.orElseThrow(MissingValueException.createSupplier(key()));
}
}
内容来源于网络,如有侵权,请联系作者删除!