Package com.vaadin.flow.server.frontend
Class FrontendVersion
java.lang.Object
com.vaadin.flow.server.frontend.FrontendVersion
- All Implemented Interfaces:
Serializable
,Comparable<FrontendVersion>
Version object for frontend versions comparison and handling.
For internal use only. May be renamed or removed in a future release.
- Since:
- See Also:
-
Constructor Summary
ConstructorDescriptionFrontendVersion
(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 TypeMethodDescriptionint
compareTo
(FrontendVersion other) Compare version numbers and return order as -1, 0 and 1.boolean
Gets the version qualifier, qualifier in x.y.z.qualifier.Gets the full version, in format x.y.z or x.y.z.qualifier.int
Gets the major version, x in x.y.z.qualifier.int
Gets the minor version, y in x.y.z.qualifier.int
Gets the revision, z in x.y.z.qualifier.int
hashCode()
boolean
isEqualTo
(FrontendVersion otherVersion) Check if this and the given version are equal to each other.boolean
isNewerThan
(FrontendVersion otherVersion) Check if this version is newer than given version.boolean
isOlderThan
(FrontendVersion otherVersion) Check if this version is older than given version.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.
- 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.
- 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.- Returns:
- the full version number
-
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
-
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:
compareTo
in interfaceComparable<FrontendVersion>
- Parameters:
other
- version to compare against this version- Returns:
- -1 this is older, 0 versions equal, 1 this is newer
-