Package net.shibboleth.profile.installablecomponent

# Class InstallableComponentVersion

java.lang.Object
net.shibboleth.profile.installablecomponent.InstallableComponentVersion

All Implemented Interfaces:
  `Comparable<InstallableComponentVersion>`

public class InstallableComponentVersion extends Object implements Comparable<InstallableComponentVersion>
A version string (Major.minor.patch) as a handy class.

## Field Summary

Fields
Modifier and Type
Field
Description
`private int`
`major`
Major version.
`private static final int`
`MAX_VNO`
arbitrary maximum (to help hashing and sanity).
`private int`
`minor`
Minor version.
`private int`
`patch`
Patch version.

## Constructor Summary

Constructors
Constructor
Description
`InstallableComponentVersion(int maj, int min, int pat)`
Constructor.
`InstallableComponentVersion(String version)`
Constructor.
`InstallableComponentVersion(Plugin<? extends Module> plugin)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`int`
`compareTo(InstallableComponentVersion other)`
Compares this object with the specified object for order.
`boolean`
`equals(Object obj)`
`int`
`getMajor()`
Get the major version.
`int`
`getMinor()`
Get the minor version.
`int`
`getPatch()`
Get the patch version.
`int`
`hashCode()`
`boolean`
`isNull()`
Is this version all zeros (usually as a result of a parsing issue.
`private int`
`parseValue(String valueAsString)`
Helper function for the constructor.
`String`
`toString()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Field Details

### MAX_VNO

private static final int MAX_VNO
arbitrary maximum (to help hashing and sanity).

See Also:
  - Constant Field Values

### major

private int major
Major version.

### minor

private int minor
Minor version.

### patch

private int patch
Patch version.

## Constructor Details

### InstallableComponentVersion

public InstallableComponentVersion(String version) throws NumberFormatException
Constructor.

Parameters:
  `version` - what to build from
Throws:
  `NumberFormatException` - if it doesn't fit a 1.2.3 format or if the values are out of range

### InstallableComponentVersion

public InstallableComponentVersion(@Nonnull Plugin<? extends Module> plugin) throws NumberFormatException
Constructor.

Parameters:
  `plugin` - what to get the version of.
Throws:
  `NumberFormatException` - if the values are out of range

### InstallableComponentVersion

public InstallableComponentVersion(int maj, int min, int pat) throws NumberFormatException
Constructor.

Parameters:
  `maj` - Major Version
  `min` - Minor Version
  `pat` - Patch Version
Throws:
  `NumberFormatException` - if the values are out of range

## Method Details

### getMajor

public int getMajor()
Get the major version.

Returns:
  Returns the major version.

### getMinor

public int getMinor()
Get the minor version.

Returns:
  Returns the minor version.

### getPatch

public int getPatch()
Get the patch version.

Returns:
  Returns the patch version.

### isNull

public boolean isNull()
Is this version all zeros (usually as a result of a parsing issue.

The Jackson annotation is used to exclude this getter from serialization for metrics.

Returns:
  if all nulls

### parseValue

private int parseValue(String valueAsString) throws NumberFormatException
Helper function for the constructor. Parse a string into an int with a range check.

Parameters:
  `valueAsString` - what to parse
Returns:
  the value as an int
Throws:
  `NumberFormatException` - if `Integer.parseInt(String, int)` does or if the value is less than 0 or > `MAX_VNO`.

### equals

public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### compareTo

public int compareTo(InstallableComponentVersion other)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Specified by:
  `compareTo` in interface `Comparable<InstallableComponentVersion>`

### toString

public String toString()

Overrides:
  `toString` in class `Object`