本文整理了Java中io.vavr.control.Option.getOrNull()
方法的一些代码示例,展示了Option.getOrNull()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Option.getOrNull()
方法的具体详情如下:
包路径:io.vavr.control.Option
类名称:Option
方法名:getOrNull
暂无
代码示例来源:origin: apache/incubator-pinot
@Override
public Map<String, ?> apply(Map<String, ?> childKeys, String pathPrefix) {
// Adjust the name to add the table suffix to table.name.realtime/table.name.offline
List<String> tableTypes = childKeys.get("table.types").map(tableTypesListOrString -> {
if (tableTypesListOrString instanceof String) {
return List.of((String) tableTypesListOrString);
} else if (tableTypesListOrString instanceof Collection) {
return List.ofAll((Collection<String>) tableTypesListOrString);
} else {
return List.empty();
}
}).getOrElse(List.empty()).map(Object::toString);
String tableName = childKeys.get("table.name").map(Object::toString).getOrElse(
() -> childKeys.get("table.name.realtime").map(Object::toString)
.getOrElse(() -> childKeys.get("table.name.offline").map(Object::toString).getOrNull()));
Map<String, Object> remappedConfig = (Map<String, Object>) childKeys;
for (String tableType : tableTypes) {
String tableNameKey = "table.name." + tableType.toLowerCase();
CommonConstants.Helix.TableType type = CommonConstants.Helix.TableType.valueOf(tableType.toUpperCase());
remappedConfig = remappedConfig.put(tableNameKey, TableNameBuilder.forType(type).tableNameWithType(tableName));
}
remappedConfig = remappedConfig.remove("table.name");
return remappedConfig;
}
代码示例来源:origin: jdbi/jdbi
.map(t -> t._2 + ": " + t._3.getOrNull());
throw new NoSuchMapperException(type + " cannot be mapped. "
+ "If tuple columns are configured (TupleMappers config class), "
代码示例来源:origin: com.mercateo.eventstore/client-common
public Option<EventStore> getEventStore(EventStoreName eventStoreName) {
return Option.of(eventstores.computeIfAbsent(eventStoreName, name -> createEventStore(name).getOrNull()));
}
代码示例来源:origin: com.mercateo.eventstore/client-common
public Option<EventStream> getEventStream(EventStreamId eventStreamId) {
return Option.of(eventstreams.computeIfAbsent(eventStreamId, definition -> getEventStore(eventStreamId
.eventStoreName()).map(eventStore -> new EventStream(eventStore, eventStreamId)).getOrNull()));
}
内容来源于网络,如有侵权,请联系作者删除!