Enum Class VersionChange

java.lang.Object
java.lang.Enum<VersionChange>
me.remigio07.chatplugin.api.common.util.VersionChange
All Implemented Interfaces:
Serializable, Comparable<VersionChange>, Constable

public enum VersionChange extends Enum<VersionChange>
Represents a major, minor or patch change in a version (example: 1.8.0 -> 1.9.0).
  • Enum Constant Details

    • MAJOR_UPGRADE

      public static final VersionChange MAJOR_UPGRADE
      Represents a major version upgrade (X.x.x).
    • MAJOR_DOWNGRADE

      public static final VersionChange MAJOR_DOWNGRADE
      Represents a major version downgrade (X.x.x).
    • MINOR_UPGRADE

      public static final VersionChange MINOR_UPGRADE
      Represents a minor version upgrade (x.X.x).
    • MINOR_DOWNGRADE

      public static final VersionChange MINOR_DOWNGRADE
      Represents a minor version downgrade (x.X.x).
    • PATCH_UPGRADE

      public static final VersionChange PATCH_UPGRADE
      Represents a patch version upgrade (x.x.X).
    • PATCH_DOWNGRADE

      public static final VersionChange PATCH_DOWNGRADE
      Represents a patch version downgrade (x.x.X).
    • NULL

      public static final VersionChange NULL
      Represents a null version change (x.x.x).
  • Method Details

    • values

      public static VersionChange[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static VersionChange valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getIndex

      public int getIndex()
      Gets this version change's index. Example: x.x.X ➝ 2.
      Returns:
      Version change's index
    • isSupported

      public boolean isSupported()
      Checks if this version change is supported.
      Returns:
      Whether this version change is supported
    • isMajor

      public boolean isMajor()
      Checks if this is a major (X.x.x) version change.
      Returns:
      Whether this is a major version change
    • isMinor

      public boolean isMinor()
      Checks if this is a minor (x.X.x) version change.
      Returns:
      Whether this is a minor version change
    • isPatch

      public boolean isPatch()
      Checks if this is a patch (x.x.X) version change.
      Returns:
      Whether this is a patch version change
    • getVersionChange

      public static VersionChange getVersionChange(String version, String newVersion)
      Gets the version change by comparing the specified version to another one.

      Will return NULL if the two versions match. Modifiers (like "-SNAPSHOT") will not be considered.

      Parameters:
      version - Version to compare
      newVersion - New version to compare
      Returns:
      Current version change
      Throws:
      IndexOutOfBoundsException - If specified versions do not follow Semantic Versioning
      NumberFormatException - If specified versions do not follow Semantic Versioning
    • getVersionChange

      public static VersionChange getVersionChange(Configuration configuration, String path, String newVersion)
      Gets the version change by comparing the version in the specified configuration to another one.

      Will return NULL if the two versions match. Modifiers (like "-SNAPSHOT") will not be considered.

      Parameters:
      configuration - Configuration to check
      path - Path containing the version to compare
      newVersion - New version to compare
      Returns:
      Current version change
      Throws:
      IndexOutOfBoundsException - If specified versions do not follow Semantic Versioning
      NumberFormatException - If specified versions do not follow Semantic Versioning