Class ApiVersion


  • public class ApiVersion
    extends java.lang.Object
    Represents a version of an api.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ApiVersion.Compatibility
      Describes compatibility between the current version of an API and a requested version
    • Constructor Summary

      Constructors 
      Constructor Description
      ApiVersion​(int human, int major, int minor)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int human()
      Returns the human version of the api.
      int major()
      Returns the major version of the api.
      int minor()
      Returns the minor version of the api.
      ApiVersion.Compatibility supportsRequestedVersion​(int human, int major, int minor)
      Checks whether an API described by this version has a good likelihood of supporting an API consumer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ApiVersion

        public ApiVersion​(int human,
                          int major,
                          int minor)
    • Method Detail

      • human

        public int human()
        Returns the human version of the api.
      • major

        public int major()
        Returns the major version of the api.
      • minor

        public int minor()
        Returns the minor version of the api.
      • supportsRequestedVersion

        public ApiVersion.Compatibility supportsRequestedVersion​(int human,
                                                                 int major,
                                                                 int minor)
        Checks whether an API described by this version has a good likelihood of supporting an API consumer.

        The compatibility is described as follows: The human version must match. The requested major version must be equal or smaller than this major version. If the major versions are equal, the requested minor version must be equal or smaller than this minor version.

        Parameters:
        human - the requested human version
        major - the requested major version
        minor - the requested minor version
        Returns:
        a ApiVersion.Compatibility indicating whether this version may support the requested version