Package com.io7m.coffeepick.runtime

# Class RuntimeVersion

java.lang.Object
com.io7m.coffeepick.runtime.RuntimeVersion

All Implemented Interfaces:
  `RuntimeVersionType`, `java.lang.Comparable<RuntimeVersionType>`

    public final class RuntimeVersion
    extends java.lang.Object
    implements RuntimeVersionType

A (slightly reduced) version number for Java runtimes. This version represents a subset of the possible data present in Java runtime versions. Specifically, this version number represents just the semantic versioning information, plus a build number.

See Also:
  "https://openjdk.java.net/jeps/223"

- ## Nested Class Summary

  Nested Classes
  Modifier and Type | Class | Description
  --- | --- | ---
  `static class` | `RuntimeVersion.Builder` | Builds instances of type `RuntimeVersion`.

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `java.util.Optional<java.math.BigInteger>` | `build()` |
  `static RuntimeVersion.Builder` | `builder()` | Creates a builder for `RuntimeVersion`.
  `static RuntimeVersion` | `copyOf​(RuntimeVersionType instance)` | Creates an immutable copy of a `RuntimeVersionType` value.
  `boolean` | `equals​(java.lang.Object another)` | This instance is equal to all instances of `RuntimeVersion` that have equal attribute values.
  `int` | `hashCode()` | Computes a hash code from attributes: `major`, `minor`, `patch`, `build`.
  `java.math.BigInteger` | `major()` |
  `java.math.BigInteger` | `minor()` |
  `java.math.BigInteger` | `patch()` |
  `java.lang.String` | `toString()` | Prints the immutable value `RuntimeVersion` with attribute values.
  `RuntimeVersion` | `withBuild​(java.math.BigInteger value)` | Copy the current immutable object by setting a present value for the optional `build` attribute.
  `RuntimeVersion` | `withBuild​(java.util.Optional<? extends java.math.BigInteger> optional)` | Copy the current immutable object by setting an optional value for the `build` attribute.
  `RuntimeVersion` | `withMajor​(java.math.BigInteger value)` | Copy the current immutable object by setting a value for the `major` attribute.
  `RuntimeVersion` | `withMinor​(java.math.BigInteger value)` | Copy the current immutable object by setting a value for the `minor` attribute.
  `RuntimeVersion` | `withPatch​(java.math.BigInteger value)` | Copy the current immutable object by setting a value for the `patch` attribute.

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

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

  ### Methods inherited from interface com.io7m.coffeepick.runtime.RuntimeVersionType

  `compareTo, toExternalMinimalString, toExternalString`

- ## Method Details

  - ### major

    public java.math.BigInteger major()
    Specified by:
      `major` in interface `RuntimeVersionType`
    Returns:
      The major version

  - ### minor

    public java.math.BigInteger minor()
    Specified by:
      `minor` in interface `RuntimeVersionType`
    Returns:
      The minor version

  - ### patch

    public java.math.BigInteger patch()
    Specified by:
      `patch` in interface `RuntimeVersionType`
    Returns:
      The patch version

  - ### build

    public java.util.Optional<java.math.BigInteger> build()
    Specified by:
      `build` in interface `RuntimeVersionType`
    Returns:
      The build number, if any

  - ### withMajor

    public final RuntimeVersion withMajor​(java.math.BigInteger value)
    Copy the current immutable object by setting a value for the `major` attribute. An equals check used to prevent copying of the same value by returning `this`.
    Parameters:
      `value` - A new value for major
    Returns:
      A modified copy of the `this` object

  - ### withMinor

    public final RuntimeVersion withMinor​(java.math.BigInteger value)
    Copy the current immutable object by setting a value for the `minor` attribute. An equals check used to prevent copying of the same value by returning `this`.
    Parameters:
      `value` - A new value for minor
    Returns:
      A modified copy of the `this` object

  - ### withPatch

    public final RuntimeVersion withPatch​(java.math.BigInteger value)
    Copy the current immutable object by setting a value for the `patch` attribute. An equals check used to prevent copying of the same value by returning `this`.
    Parameters:
      `value` - A new value for patch
    Returns:
      A modified copy of the `this` object

  - ### withBuild

    public final RuntimeVersion withBuild​(java.math.BigInteger value)
    Copy the current immutable object by setting a present value for the optional `build` attribute.
    Parameters:
      `value` - The value for build
    Returns:
      A modified copy of `this` object

  - ### withBuild

    public final RuntimeVersion withBuild​(java.util.Optional<? extends java.math.BigInteger> optional)
    Copy the current immutable object by setting an optional value for the `build` attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning `this`.
    Parameters:
      `optional` - A value for build
    Returns:
      A modified copy of `this` object

  - ### equals

    public boolean equals​(java.lang.Object another)
    This instance is equal to all instances of `RuntimeVersion` that have equal attribute values.
    Overrides:
      `equals` in class `java.lang.Object`
    Returns:
      `true` if `this` is equal to `another` instance

  - ### hashCode

    public int hashCode()
    Computes a hash code from attributes: `major`, `minor`, `patch`, `build`.
    Overrides:
      `hashCode` in class `java.lang.Object`
    Returns:
      hashCode value

  - ### toString

    public java.lang.String toString()
    Prints the immutable value `RuntimeVersion` with attribute values.
    Overrides:
      `toString` in class `java.lang.Object`
    Returns:
      A string representation of the value

  - ### copyOf

    public static RuntimeVersion copyOf​(RuntimeVersionType instance)
    Creates an immutable copy of a `RuntimeVersionType` value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
    Parameters:
      `instance` - The instance to copy
    Returns:
      A copied immutable RuntimeVersion instance

  - ### builder

    public static RuntimeVersion.Builder builder()
    Creates a builder for `RuntimeVersion`.

         RuntimeVersion.builder()
            .setMajor(java.math.BigInteger) // required major
            .setMinor(java.math.BigInteger) // required minor
            .setPatch(java.math.BigInteger) // required patch
            .setBuild(java.math.BigInteger) // optional build
            .build();

    Returns:
      A new RuntimeVersion builder