io.vavr.control.Option.getOrNull()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(204)

本文整理了Java中io.vavr.control.Option.getOrNull()方法的一些代码示例,展示了Option.getOrNull()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Option.getOrNull()方法的具体详情如下:
包路径:io.vavr.control.Option
类名称:Option
方法名:getOrNull

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()));
}

相关文章