public class HadoopVersionInfo extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
HadoopVersionInfo.ParseState
ParseState is used by subclasses that are parsing version strings.
|
Constructor and Description |
---|
HadoopVersionInfo()
Construct a HadoopVersionInfo using the version string contained in
VersionInfo.getVersion() . |
HadoopVersionInfo(String versionString)
Construct a HadoopVersionInfo using the passed version string
|
Modifier and Type | Method and Description |
---|---|
protected void |
discardSeparator(HadoopVersionInfo.ParseState state) |
static HadoopVersionInfo |
getInstance() |
com.google.common.base.Optional<Integer> |
getMajorVersion()
Get the major part of the version.
|
com.google.common.base.Optional<Integer> |
getMinorVersion()
Get the minor part of the version
|
com.google.common.base.Optional<Integer> |
getPatchLevel()
Get the patch level of the version
|
boolean |
isEqualTo(int major,
int minor)
Determine if the object is equal to the given major / minor versions
|
boolean |
isGreaterThan(int major,
int minor)
Determine if this object is greater than the passed version number.
|
boolean |
isLessThan(int major,
int minor)
Determine if this object is less than the passed version number.
|
protected com.google.common.base.Optional<Integer> |
parseNumberPiece(HadoopVersionInfo.ParseState state) |
protected boolean |
parseVersionString(String version) |
public HadoopVersionInfo()
VersionInfo.getVersion()
.public HadoopVersionInfo(String versionString)
versionString
- A string of the form major.minor.patchpublic static HadoopVersionInfo getInstance()
protected boolean parseVersionString(String version)
protected com.google.common.base.Optional<Integer> parseNumberPiece(HadoopVersionInfo.ParseState state)
protected void discardSeparator(HadoopVersionInfo.ParseState state)
public com.google.common.base.Optional<Integer> getMajorVersion()
public com.google.common.base.Optional<Integer> getMinorVersion()
public com.google.common.base.Optional<Integer> getPatchLevel()
public boolean isGreaterThan(int major, int minor)
major
- The major number to compare againstminor
- The minor number to compare againstpublic boolean isLessThan(int major, int minor)
major
- The major number to compare againstminor
- The minor number to compare againstpublic boolean isEqualTo(int major, int minor)
major
- The major version numberminor
- The minor version numberCopyright © 2016. All rights reserved.