@NotThreadSafe public class DependencyVersion extends Object implements Iterable<String>, Comparable<DependencyVersion>
Simple object to track the parts of a version number. The parts are contained
in a List such that version 1.2.3 will be stored as: versionParts[0] = 1;
versionParts[1] = 2;
versionParts[2] = 3;
Note, the parser contained in this class expects the version numbers to be separated by periods. If a different separator is used the parser will likely fail.
| Constructor and Description |
|---|
DependencyVersion()
Constructor for a empty DependencyVersion.
|
DependencyVersion(String version)
Constructor for a DependencyVersion that will parse a version string.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(@NotNull DependencyVersion version) |
boolean |
equals(Object obj)
Compares the equality of this object to the one passed in as a parameter.
|
List<String> |
getVersionParts()
Get the value of versionParts.
|
int |
hashCode()
Calculates the hashCode for this object.
|
@NotNull Iterator<String> |
iterator()
Retrieves an iterator for the version parts.
|
boolean |
matchesAtLeastThreeLevels(DependencyVersion version)
Determines if the three most major major version parts are identical.
|
void |
parseVersion(String version)
Parses a version string into its sub parts: major, minor, revision,
build, etc.
|
void |
setVersionParts(List<String> versionParts)
Set the value of versionParts.
|
String |
toString()
Reconstructs the version string from the split version parts.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic DependencyVersion()
public DependencyVersion(String version)
version - the well formatted version number to parsepublic final void parseVersion(String version)
version - the version string to parsepublic List<String> getVersionParts()
public void setVersionParts(List<String> versionParts)
versionParts - new value of versionParts@NotNull public @NotNull Iterator<String> iterator()
public String toString()
public boolean equals(Object obj)
public int hashCode()
public boolean matchesAtLeastThreeLevels(DependencyVersion version)
version - the version number to comparepublic int compareTo(@NotNull
@NotNull DependencyVersion version)
compareTo in interface Comparable<DependencyVersion>Copyright © 2012–2020 OWASP. All rights reserved.