Enum Class VersionChange
- All Implemented Interfaces:
Serializable,Comparable<VersionChange>,Constable
Represents a major, minor or patch change in a version (example: 1.8.0 -> 1.9.0).
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionRepresents a major version downgrade (X.x.x).Represents a major version upgrade (X.x.x).Represents a minor version downgrade (x.X.x).Represents a minor version upgrade (x.X.x).Represents a null version change (x.x.x).Represents a patch version downgrade (x.x.X).Represents a patch version upgrade (x.x.X). -
Method Summary
Modifier and TypeMethodDescriptionintgetIndex()Gets this version change's index.static VersionChangegetVersionChange(String version, String newVersion) Gets the version change by comparing the specified version to another one.static VersionChangegetVersionChange(Configuration configuration, String path, String newVersion) Gets the version change by comparing the version in the specified configuration to another one.booleanisMajor()Checks if this is a major (X.x.x) version change.booleanisMinor()Checks if this is a minor (x.X.x) version change.booleanisPatch()Checks if this is a patch (x.x.X) version change.booleanChecks if this version change is supported.static VersionChangeReturns the enum constant of this class with the specified name.static VersionChange[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
MAJOR_UPGRADE
Represents a major version upgrade (X.x.x). -
MAJOR_DOWNGRADE
Represents a major version downgrade (X.x.x). -
MINOR_UPGRADE
Represents a minor version upgrade (x.X.x). -
MINOR_DOWNGRADE
Represents a minor version downgrade (x.X.x). -
PATCH_UPGRADE
Represents a patch version upgrade (x.x.X). -
PATCH_DOWNGRADE
Represents a patch version downgrade (x.x.X). -
NULL
Represents a null version change (x.x.x).
-
-
Method Details
-
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
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 nameNullPointerException- 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
Gets the version change by comparing the specified version to another one.Will return
NULLif the two versions match. Modifiers (like "-SNAPSHOT") will not be considered.- Parameters:
version- Version to comparenewVersion- New version to compare- Returns:
- Current version change
- Throws:
IndexOutOfBoundsException- If specified versions do not follow Semantic VersioningNumberFormatException- 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
NULLif the two versions match. Modifiers (like "-SNAPSHOT") will not be considered.- Parameters:
configuration- Configuration to checkpath- Path containing the version to comparenewVersion- New version to compare- Returns:
- Current version change
- Throws:
IndexOutOfBoundsException- If specified versions do not follow Semantic VersioningNumberFormatException- If specified versions do not follow Semantic Versioning
-