Class FrontendVersion
- All Implemented Interfaces:
Serializable,Comparable<FrontendVersion>
Equality, hash codes and ordering use version parts only, ignoring npm alias
targets. Use isSameDependency(FrontendVersion) when both the version
and package target must match, or
hasSamePackageTarget(FrontendVersion) to compare targets alone.
For internal use only. May be renamed or removed in a future release.
- Since:
- 25.1
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFrontendVersion(int major, int minor) Create a version of format "major.minor.0".FrontendVersion(int major, int minor, int revision) Create a version of format "major.minor.revision".FrontendVersion(int major, int minor, int revision, String build) Create a version of format "major.minor.revision.build"FrontendVersion(String version) Parse version numbers from version string with the format "major.minor.revision[.build]".FrontendVersion(String name, String version) Parse version numbers from version string with the format "major.minor.revision[.build]". -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(FrontendVersion other) Compare version numbers and return order as -1, 0 and 1.booleanGets the version qualifier, qualifier in x.y.z.qualifier.Gets the full version, in format x.y.z or x.y.z.qualifier.intGets the major version, x in x.y.z.qualifier.intGets the minor version, y in x.y.z.qualifier.intGets the revision, z in x.y.z.qualifier.inthashCode()booleanChecks whether two versions refer to the same npm alias target, or both are ordinary versions.booleanisEqualOrNewer(FrontendVersion otherVersion) Check if this version is equal or newer than given version.booleanisEqualTo(FrontendVersion otherVersion) Check if this and the given version are equal to each other.booleanisNewerThan(FrontendVersion otherVersion) Check if this version is newer than given version.booleanisOlderThan(FrontendVersion otherVersion) Check if this version is older than given version.booleanisSameDependency(FrontendVersion other) Checks both package target and version when detecting dependency edits.toString()
-
Constructor Details
-
FrontendVersion
public FrontendVersion(int major, int minor) Create a version of format "major.minor.0".- Parameters:
major- major versionminor- minor version
-
FrontendVersion
public FrontendVersion(int major, int minor, int revision) Create a version of format "major.minor.revision".- Parameters:
major- major versionminor- minor versionrevision- revision number
-
FrontendVersion
Create a version of format "major.minor.revision.build"- Parameters:
major- major versionminor- minor versionrevision- revision numberbuild- build identifier
-
FrontendVersion
Parse version numbers from version string with the format "major.minor.revision[.build]". The build part is optional.Versions are normalized and any caret or tildes will not be considered when comparing versions. Versioned npm aliases are compared using their embedded version, while retaining the full alias specification.
- Parameters:
version- version string as "major.minor.revision[.build]"
-
FrontendVersion
Parse version numbers from version string with the format "major.minor.revision[.build]". The build part is optional.Versions are normalized and any caret or tildes will not be considered when comparing versions. Versioned npm aliases are compared using their embedded version, while retaining the full alias specification.
- Parameters:
name- the name of the artifact which version is to be parsed, used in error message to help discover the issueversion- version string as "major.minor.revision[.build]"
-
-
Method Details
-
getFullVersion
Gets the full version, in format x.y.z or x.y.z.qualifier. For npm aliases, returns the complete alias specification so that writing it back preserves the target package.- Returns:
- the full version number
-
hasSamePackageTarget
Checks whether two versions refer to the same npm alias target, or both are ordinary versions. Version ordering itself ignores alias targets.- Parameters:
other- the version to compare- Returns:
- whether the package targets match
-
isSameDependency
Checks both package target and version when detecting dependency edits.- Parameters:
other- the version to compare- Returns:
- whether the target and parsed version are equal
-
getMajorVersion
public int getMajorVersion()Gets the major version, x in x.y.z.qualifier.- Returns:
- the major version number
-
getMinorVersion
public int getMinorVersion()Gets the minor version, y in x.y.z.qualifier.- Returns:
- the minor version number
-
getRevision
public int getRevision()Gets the revision, z in x.y.z.qualifier.- Returns:
- the revision number
-
getBuildIdentifier
Gets the version qualifier, qualifier in x.y.z.qualifier.- Returns:
- the version qualifier
-
isOlderThan
Check if this version is older than given version. Will return false if equals or is newer.- Parameters:
otherVersion- version to check against- Returns:
- true if this is older than otherVersion
-
isNewerThan
Check if this version is newer than given version. Will return false if equals or is older.- Parameters:
otherVersion- version to check against- Returns:
- true if this is newer than otherVersion
-
isEqualOrNewer
Check if this version is equal or newer than given version. Will return false if is older.- Parameters:
otherVersion- version to check against- Returns:
- true if this is newer than or equal to otherVersion
-
isEqualTo
Check if this and the given version are equal to each other.- Parameters:
otherVersion- version to test equals with- Returns:
- true if parsed version parts are exactly the same
-
equals
-
toString
-
hashCode
public int hashCode() -
compareTo
Compare version numbers and return order as -1, 0 and 1. Where this version is older, equals, newer than given version.- Specified by:
compareToin interfaceComparable<FrontendVersion>- Parameters:
other- version to compare against this version- Returns:
- -1 this is older, 0 versions equal, 1 this is newer
-