org.semver
Class Version

java.lang.Object
  extended by org.semver.Version
All Implemented Interfaces:
java.lang.Comparable<Version>

public class Version
extends java.lang.Object
implements java.lang.Comparable<Version>

Version following semantic defined by Semantic Versioning document.


Nested Class Summary
static class Version.Type
          Version element type.
 
Constructor Summary
Version(int major, int minor, int patch)
           
Version(int major, int minor, int patch, java.lang.String special)
           
 
Method Summary
 int compareTo(Version other)
           
 Version.Type delta(Version other)
           
 boolean equals(java.lang.Object object)
           
 int hashCode()
           
 boolean isInDevelopment()
           
 boolean isStable()
           
 Version next(Version.Type type)
           
static Version parse(java.lang.String version)
          Creates a Version from a string representation.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Version

public Version(@Nonnegative
               int major,
               @Nonnegative
               int minor,
               @Nonnegative
               int patch)

Version

public Version(@Nonnegative
               int major,
               @Nonnegative
               int minor,
               @Nonnegative
               int patch,
               @Nonnull
               java.lang.String special)
Method Detail

parse

public static Version parse(@Nonnull
                            java.lang.String version)
Creates a Version from a string representation. Must match Version#FORMAT.

Parameters:
version -
Returns:

next

public Version next(@Nonnull
                    Version.Type type)
Parameters:
type -
Returns:
next Version regarding specified Version.Type

delta

public Version.Type delta(@Nonnull
                          Version other)
Parameters:
other -
Returns:
most important differing Version.Type component between this and another Version, null if both are same.

isInDevelopment

public boolean isInDevelopment()

isStable

public boolean isStable()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(@Nullable
                      java.lang.Object object)
Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(Version other)
Specified by:
compareTo in interface java.lang.Comparable<Version>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2010. All Rights Reserved.