Spring Data Core

org.springframework.data.util
Class Version

java.lang.Object
  extended by org.springframework.data.util.Version
All Implemented Interfaces:
Comparable<Version>

public class Version
extends Object
implements Comparable<Version>

Value object to represent a Version consisting of major, minor and bugfix part.

Author:
Oliver Gierke

Constructor Summary
Version(int... parts)
          Creates a new Version from the given integer values.
 
Method Summary
 int compareTo(Version that)
           
 boolean equals(Object obj)
           
 int hashCode()
           
 boolean is(Version version)
          Returns whether the current Version is the same as the given one.
 boolean isGreaterThan(Version version)
          Returns whether the current Version is greater (newer) than the given one.
 boolean isGreaterThanOrEqualTo(Version version)
          Returns whether the current Version is greater (newer) or the same as the given one.
 boolean isLessThan(Version version)
          Returns whether the current Version is less (older) than the given one.
 boolean isLessThanOrEqualTo(Version version)
          Returns whether the current Version is less (older) or equal to the current one.
static Version parse(String version)
          Parses the given string representation of a version into a Version object.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Version

public Version(int... parts)
Creates a new Version from the given integer values. At least one value has to be given but a maximum of 4.

Parameters:
parts - must not be null or empty.
Method Detail

parse

public static Version parse(String version)
Parses the given string representation of a version into a Version object.

Parameters:
version - must not be null or empty.
Returns:

isGreaterThan

public boolean isGreaterThan(Version version)
Returns whether the current Version is greater (newer) than the given one.

Parameters:
version -
Returns:

isGreaterThanOrEqualTo

public boolean isGreaterThanOrEqualTo(Version version)
Returns whether the current Version is greater (newer) or the same as the given one.

Parameters:
version -
Returns:

is

public boolean is(Version version)
Returns whether the current Version is the same as the given one.

Parameters:
version -
Returns:

isLessThan

public boolean isLessThan(Version version)
Returns whether the current Version is less (older) than the given one.

Parameters:
version -
Returns:

isLessThanOrEqualTo

public boolean isLessThanOrEqualTo(Version version)
Returns whether the current Version is less (older) or equal to the current one.

Parameters:
version -
Returns:

compareTo

public int compareTo(Version that)
Specified by:
compareTo in interface Comparable<Version>

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

Spring Data Core

Copyright © 2011-2014–2014 Pivotal Software, Inc.. All rights reserved.