[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Moving out of the UnifiedClassloaders

alesj do-not-reply at jboss.com
Sun Jan 20 20:46:37 EST 2008


"adrian at 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



More information about the jboss-dev-forums mailing list