Examples of ComparableVersion


Examples of org.apache.maven.artifact.versioning.ComparableVersion

        //doesn't yield the expected results (the latest versions are not returned), so we rely on a fuzzier search
        //and refine the results.
        Map<String, IndexedArtifact> values = index.search(a, IIndex.SEARCH_PLUGIN);
        if(!values.isEmpty()) {
          SortedSet<ComparableVersion> versions = new TreeSet<ComparableVersion>();
          ComparableVersion referenceComparableVersion = referenceVersion == null ? null : new ComparableVersion(
              referenceVersion);

          for(Map.Entry<String, IndexedArtifact> e : values.entrySet()) {
            if(!(e.getKey().endsWith(partialKey))) {
              continue;
            }
            for(IndexedArtifactFile f : e.getValue().getFiles()) {
              if(groupId.equals(f.group) && artifactId.equals(f.artifact) && !f.version.contains("-SNAPSHOT")) { //$NON-NLS-1$
                ComparableVersion v = new ComparableVersion(f.version);
                if(referenceComparableVersion == null || v.compareTo(referenceComparableVersion) > 0) {
                  versions.add(v);
                }
              }
            }
            if(!versions.isEmpty()) {
              List<String> sorted = new ArrayList<String>(versions.size());
              for(ComparableVersion v : versions) {
                sorted.add(v.toString());
              }
              Collections.reverse(sorted);
              version = sorted.iterator().next();
            }
          }
View Full Code Here

Examples of org.apache.maven.artifact.versioning.ComparableVersion

    public boolean maven3orLater(String mavenVersion) {
        // null or empty so false !
        if (StringUtils.isBlank( mavenVersion )) {
            return false;
        }
        return new ComparableVersion (mavenVersion).compareTo( new ComparableVersion ("3.0") ) >= 0;
   
View Full Code Here

Examples of org.moxie.ComparableVersion

public class ComparableVersionTest
    extends TestCase
{
    private Comparable newComparable( String version )
    {
        return new ComparableVersion( version );
    }
View Full Code Here

Examples of org.moxie.ComparableVersion

        }
    }

    public void testReuse()
    {
        ComparableVersion c1 = new ComparableVersion( "1" );
        c1.parseVersion( "2" );

        Comparable c2 = newComparable( "2" );

        assertEquals( "reused instance should be equivalent to new instance", c1, c2 );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.