"adrian jboss.org" wrote :
| But it's one of those N^2 problems in writing
comparators between
| all the different versions, e.g. our own, maven, osgi,
java manifest, jdk7 module system, etc.
|
I've taken this approach.
Since I doubt the N will be big.
Adding VersionComparator:
| public interface VersionComparator<T extends Version,
U extends Version>
| {
| /**
| * Compare the two version impls.
| *
| * param t T version impl
| * param u U version impl
| * return compare the two version impls
| */
| int compare(T t, U u);
| }
|
and a VersionComparatorRegistry singleton to keep all the
known implementations.
And changing the Version class to delegate the compareTo to
the registry:
| public int compareTo(Version v)
| {
| VersionComparatorRegistry registry =
VersionComparatorRegistry.getInstance();
| return registry.compare(this, v);
| }
|
View the original post : http://www.jboss.com/index.html?
module=bb&op=viewtopic&p=4121688#4121688
Reply to the post : http://www.jboss.com/index.
html?module=bb&op=posting&mode=reply&p=4121688
a>
_______________________________________________
jboss-dev-forums mailing list
jboss-dev-forums lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-dev-foru
ms
|