本文整理了Java中com.yahoo.component.Version.toSpecification()
方法的一些代码示例,展示了Version.toSpecification()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.toSpecification()
方法的具体详情如下:
包路径:com.yahoo.component.Version
类名称:Version
方法名:toSpecification
[英]Creates a version specification that only matches this version
[中]创建仅与此版本匹配的版本规范
代码示例来源:origin: com.yahoo.vespa/documentapi
RoutableFactory getFactory(Version version) {
VersionSpecification versionSpec = version.toSpecification();
// Retrieve the factory with the highest version lower than or equal to actual version
return factoryVersions.entrySet().stream()
// Drop factories that have a higher version than actual version
.filter(entry -> entry.getKey().compareTo(versionSpec) <= 0)
// Get the factory with the highest version
.max((entry1, entry2) -> entry1.getKey().compareTo(entry2.getKey()))
.map(Map.Entry::getValue)
// Return factory or null if no suitable factory found
.orElse(null);
}
}
代码示例来源:origin: com.yahoo.vespa/component
public ComponentSpecification toSpecification() {
if (isAnonymous())
throw new RuntimeException("Can't generate a specification for an anonymous component id.");
return new ComponentSpecification(getName(),
getVersion().toSpecification(), getNamespace());
}
内容来源于网络,如有侵权,请联系作者删除!