public class Version extends Object implements Comparable<Version>, Serializable
Title: Version
Description: Provides a structured, validated and comparable way of representing a version
Copyright: Copyright (c) 2006-2010
| Modifier and Type | Field and Description |
|---|---|
static Version |
MAX_VALUE |
static Version |
MIN_VALUE |
| Constructor and Description |
|---|
Version()
Deprecated.
DO NOT USE THIS METHOD - FOR BEAN SERIALISER ONLY. CREATES INVALID VERSIONS
|
Version(int... vers) |
Version(String versionString)
Constructs a new version.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Version vers) |
boolean |
equals(Object o) |
int[] |
getContent()
Deprecated.
DO NOT USE THIS METHOD - FOR BEAN SERIALISER ONLY
|
int |
getField(int index)
Retrieves the given field from this Version
|
int |
getField(int index,
int defaultValue)
Retrieves the given field from this Version
|
int |
hashCode()
Produces a fairly unreliable hashCode (eg.
|
static boolean |
overlapping(Version min1,
Version max1,
Version min2,
Version max2)
Determines if 2 version ranges have any overlap
|
static Version |
parseStringComparable(String version) |
void |
setContent(int[] content)
Deprecated.
DO NOT USE THIS METHOD - FOR BEAN SERIALISER ONLY
|
String |
toComparableString() |
String |
toString() |
boolean |
within(Version min,
Version max)
Tests (inclusively) whether this version is within a given range
|
public static final Version MIN_VALUE
public static final Version MAX_VALUE
public Version(String versionString)
versionString - String The version string (eg. "1.2.3"). it MUST have at least ONE digit and match the regex
^(min|max|([0-9]+\.)*[0-9]+(\.(max|min))?)$public Version(int... vers)
@Deprecated public Version()
public int getField(int index,
int defaultValue)
index - int The index to retrieve (based at 0)defaultValue - int The default value to return if the index doesn't existpublic int getField(int index)
index - int The index to retrieve (based at 0)IllegalArgumentException - When the specified index is invalidpublic boolean within(Version min, Version max)
min - Versionmax - Versionpublic static boolean overlapping(Version min1, Version max1, Version min2, Version max2)
min1 - Version The 1st rangemax1 - Version The 1st rangemin2 - Version The 2nd rangemax2 - Version The 2nd rangepublic int compareTo(Version vers)
compareTo in interface Comparable<Version>public int hashCode()
@Deprecated public int[] getContent()
@Deprecated public void setContent(int[] content)
content - int[] A version as an integer array representing the segments (where Integer.MAX_VALUE means "max")public String toComparableString()
Copyright © 2016. All rights reserved.