org.apache.maven.artifact.versioning
Class ComparableVersion
java.lang.Object
org.apache.maven.artifact.versioning.ComparableVersion
- All Implemented Interfaces:
- Comparable<ComparableVersion>
public class ComparableVersion
- extends Object
- implements Comparable<ComparableVersion>
Generic implementation of version comparison. Features:
- mixing of '
-
' (dash) and '.
' (dot) separators,
- transition between characters and digits also constitutes a separator:
1.0alpha1 => [1, 0, alpha, 1]
- unlimited number of version components,
- version components in the text can be digits or strings
- strings are checked for well-known qualifiers and the qualifier ordering is used for version ordering.
Well-known qualifiers (case insensitive):
snapshot
alpha
or a
beta
or b
milestone
or m
rc
or cr
(the empty string)
or ga
or final
sp
- a dash usually precedes a qualifier, and is always less important than something preceded with a dot.
- Version:
- $Id: ComparableVersion.java 958295 2010-06-26 23:16:18Z hboutemy $
- Author:
- Kenney Westerhof, Hervé Boutemy
- See Also:
- "Versioning" on Maven Wiki
ComparableVersion
public ComparableVersion(String version)
parseVersion
public final void parseVersion(String version)
compareTo
public int compareTo(ComparableVersion o)
- Specified by:
compareTo
in interface Comparable<ComparableVersion>
toString
public String toString()
- Overrides:
toString
in class Object
equals
public boolean equals(Object o)
- Overrides:
equals
in class Object
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
Copyright © 2001-2011 The Apache Software Foundation. All Rights Reserved.