Class Version


  • public class Version
    extends java.lang.Object
    Encapsulation of AMQP protocol version
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int _major  
      private int _minor  
    • Constructor Summary

      Constructors 
      Constructor Description
      Version​(int major, int minor)
      Creates a new Version instance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Version adjust()
      Adjust a version for spec weirdness.
      static boolean checkVersion​(Version clientVersion, Version serverVersion)
      Check compatibility of a client and server version, from the client's perspective.
      boolean equals​(java.lang.Object o)  
      int getMajor()
      Retrieve the major version number.
      int getMinor()
      Retrieve the minor version number.
      int hashCode()  
      java.lang.String toString()
      Retrieve a String representation of the version in the standard AMQP version format of major-minor.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • _major

        private final int _major
      • _minor

        private final int _minor
    • Constructor Detail

      • Version

        public Version​(int major,
                       int minor)
        Creates a new Version instance.
        Parameters:
        major - the AMQP major version number
        minor - the AMQP minor version number
    • Method Detail

      • getMajor

        public int getMajor()
        Retrieve the major version number.
        Returns:
        the major version number
      • getMinor

        public int getMinor()
        Retrieve the minor version number.
        Returns:
        the minor version number
      • toString

        public java.lang.String toString()
        Retrieve a String representation of the version in the standard AMQP version format of major-minor.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a String representation of the version
        See Also:
        Object.toString()
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • adjust

        public Version adjust()
        Adjust a version for spec weirdness. The AMQP 0-8 spec confusingly defines the version as 8-0. This method maps the latter to the former.
        Returns:
        the adjusted Version
      • checkVersion

        public static boolean checkVersion​(Version clientVersion,
                                           Version serverVersion)
        Check compatibility of a client and server version, from the client's perspective.
        Parameters:
        clientVersion - the client Version
        serverVersion - the server Version
        Returns:
        a boolean value