smallrye / smallrye-common

Common utilities for SmallRye

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support Version Ranges in smallrye-common-version

gastaldi opened this issue · comments

It would be nice to support version ranges as predicates from a VersionScheme

Maven has the org.apache.maven.artifact.versioning.VersionRange, which could be used as a basis

Version ranges would already be supported in code using the standard Java comparator functions:

Predicate<String> inRange = v -> VersionScheme.MAVEN.compare("1.0", v) <= 0 && VersionScheme.MAVEN.compare(v, "2.0") < 0;

Since it all uses Comparator, on the code side it would be more logical to add general comparator helpers than it would be to make special ones just for versions.

On the parsing side, the Maven version range syntax is very specific to Maven, so I think that would be better put into the upcoming Maven artifact utility that I'm working on.

Are there any use cases that I missed?

Ah-ha! Interesting, maybe it would be nice to have that strategy documented somewhere. I think that covers the use cases I'm looking for.

I'm closing this issue for now.