com.vaadin.flow.server.frontend.
Class FrontendVersion
- java.lang.Object
-
- com.vaadin.flow.server.frontend.FrontendVersion
-
All Implemented Interfaces:
public class FrontendVersion extends Object implements 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
Constructors Constructor Description FrontendVersion(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
All Methods Modifier and Type Method Description int
compareTo(FrontendVersion other)
Compare version numbers and return order as -1, 0 and 1.
boolean
equals(Object obj)
String
getBuildIdentifier()
Gets the version qualifier, qualifier in x.y.z.qualifier.
String
getFullVersion()
Gets the full version, in format x.y.z or x.y.z.qualifier.
int
getMajorVersion()
Gets the major version, x in x.y.z.qualifier.
int
getMinorVersion()
Gets the minor version, y in x.y.z.qualifier.
int
getRevision()
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.
String
toString()
-
-
-
Constructor Detail
-
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
public FrontendVersion(int major, int minor, int revision, String build)
Create a version of format "major.minor.revision.build"
Parameters:
major
- major versionminor
- minor versionrevision
- revision numberbuild
- build identifier
-
FrontendVersion
public FrontendVersion(String version)
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
public FrontendVersion(String name, String version)
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 Detail
-
getFullVersion
public String 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
public String getBuildIdentifier()
Gets the version qualifier, qualifier in x.y.z.qualifier.
Returns:
the version qualifier
-
isOlderThan
public boolean isOlderThan(FrontendVersion otherVersion)
Check if this version is older than given version. Will return false if equals or is newer.
Parameters:
otherVersion
- version to check againstReturns:
true if this is older than otherVersion
-
isNewerThan
public boolean isNewerThan(FrontendVersion otherVersion)
Check if this version is newer than given version. Will return false if equals or is older.
Parameters:
otherVersion
- version to check againstReturns:
true if this is newer than otherVersion
-
isEqualTo
public boolean isEqualTo(FrontendVersion otherVersion)
Check if this and the given version are equal to each other.
Parameters:
otherVersion
- version to test equals withReturns:
true if parsed version parts are exactly the same
-
compareTo
public int compareTo(FrontendVersion other)
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 versionReturns:
-1 this is older, 0 versions equal, 1 this is newer
-
-