Class FrontendVersion

java.lang.Object
com.vaadin.flow.server.frontend.FrontendVersion
All Implemented Interfaces:
Serializable, Comparable<FrontendVersion>

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 Details

    • FrontendVersion

      public FrontendVersion(int major, int minor)
      Create a version of format "major.minor.0".
      Parameters:
      major - major version
      minor - minor version
    • FrontendVersion

      public FrontendVersion(int major, int minor, int revision)
      Create a version of format "major.minor.revision".
      Parameters:
      major - major version
      minor - minor version
      revision - 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 version
      minor - minor version
      revision - revision number
      build - 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 issue
      version - version string as "major.minor.revision[.build]"
  • Method Details

    • 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 against
      Returns:
      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 against
      Returns:
      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 with
      Returns:
      true if parsed version parts are exactly the same
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • 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 interface Comparable<FrontendVersion>
      Parameters:
      other - version to compare against this version
      Returns:
      -1 this is older, 0 versions equal, 1 this is newer