"alesj" wrote : "adrian(a)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);
| | }
| |
There are a number of issues with this,
I'll start a new thread
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4124882#...
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4124883#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...