Record Class UpgradeTaskVersion

java.lang.Object
java.lang.Record
org.opends.server.tools.upgrade.UpgradeTaskVersion
Record Components:
version - The version part of the upgrade task version to create
upgradeNumber - The number of the upgrade task version to create
All Implemented Interfaces:
Comparable<UpgradeTaskVersion>

public record UpgradeTaskVersion(com.forgerock.opendj.util.Version version, int upgradeNumber) extends Record implements Comparable<UpgradeTaskVersion>
Represents the version used for determining if the upgrade tool must be run and whether an upgrade task must run during the upgrade process.

An upgrade task version is composed of a version plus the upgrade number. The upgrade number corresponds to the total number of upgrade tasks (without the mandatory ones) added since version 2.8.0 included.

Mandatory upgrade tasks are not taken into account in the upgrade number because:

  • They are the latest to be registered, including them would have prevented us to use a counter to automatically assign a number to an upgrade task)
  • They always run when an upgrade is needed
  • The upgrade task number is not used for deciding whether an upgrade is needed, only to know if an upgrade task must run or not
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Int constant to be used for versions when upgrade between builds was not supported (i.e older than 7.0.0).
  • Constructor Summary

    Constructors
    Constructor
    Description
    UpgradeTaskVersion(com.forgerock.opendj.util.Version version, int upgradeNumber)
    Creates an instance of a UpgradeTaskVersion record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns a string representation of this record class.
    int
    Returns the value of the upgradeNumber record component.
    upgradeVersion(com.forgerock.opendj.util.Version version)
    Creates and returns a new upgrade version with no meaningful upgrade number.
    upgradeVersion(com.forgerock.opendj.util.Version version, int upgradeNumber)
    Creates and returns a new upgrade version set with provided parameters.
    com.forgerock.opendj.util.Version
    Returns the value of the version record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • UPGRADE_NUMBER_NOT_APPLICABLE

      public static final int UPGRADE_NUMBER_NOT_APPLICABLE
      Int constant to be used for versions when upgrade between builds was not supported (i.e older than 7.0.0).
      See Also:
  • Constructor Details

    • UpgradeTaskVersion

      public UpgradeTaskVersion(com.forgerock.opendj.util.Version version, int upgradeNumber)
      Creates an instance of a UpgradeTaskVersion record class.
      Parameters:
      version - the value for the version record component
      upgradeNumber - the value for the upgradeNumber record component
  • Method Details

    • upgradeVersion

      public static UpgradeTaskVersion upgradeVersion(com.forgerock.opendj.util.Version version)
      Creates and returns a new upgrade version with no meaningful upgrade number.

      This method is used for compatibility with versions where upgrade number is not supported (versions older than 7.0.0).

      Parameters:
      version - The version part of the upgrade task version to create
      Returns:
      A new upgrade task version with no meaningful upgrade number
    • upgradeVersion

      public static UpgradeTaskVersion upgradeVersion(com.forgerock.opendj.util.Version version, int upgradeNumber)
      Creates and returns a new upgrade version set with provided parameters.
      Parameters:
      version - The version part of the upgrade task version to create
      upgradeNumber - The number of the upgrade task version to create
      Returns:
      A new upgrade task version
    • compareTo

      public int compareTo(UpgradeTaskVersion other)
      Specified by:
      compareTo in interface Comparable<UpgradeTaskVersion>
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • version

      public com.forgerock.opendj.util.Version version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • upgradeNumber

      public int upgradeNumber()
      Returns the value of the upgradeNumber record component.
      Returns:
      the value of the upgradeNumber record component