use of co.cask.cdap.api.plugin.PluginClass in project cdap by caskdata.
the class ArtifactSelector method select.
@Override
public Map.Entry<ArtifactId, PluginClass> select(SortedMap<ArtifactId, PluginClass> plugins) {
NavigableMap<ArtifactId, PluginClass> pluginMap;
if (plugins instanceof NavigableMap) {
pluginMap = (NavigableMap<ArtifactId, PluginClass>) plugins;
} else {
pluginMap = new TreeMap<>();
pluginMap.putAll(plugins);
}
for (Map.Entry<ArtifactId, PluginClass> entry : pluginMap.descendingMap().entrySet()) {
ArtifactId artifactId = entry.getKey();
if ((scope == null || artifactId.getScope().equals(scope)) && (name == null || artifactId.getName().equals(name)) && (range == null || range.versionIsInRange(artifactId.getVersion()))) {
return entry;
}
}
throw new IllegalArgumentException(errMsg);
}
Aggregations