Home » HttpComponents-Core-4.0.1 » org.apache.http » [javadoc | source]
org.apache.http
public class: ProtocolVersion [javadoc | source]
java.lang.Object
   org.apache.http.ProtocolVersion

All Implemented Interfaces:
    Cloneable, Serializable

Direct Known Subclasses:
    SipVersion, HttpVersion

Represents a protocol version. The "major.minor" numbering scheme is used to indicate versions of the protocol.

This class defines a protocol version as a combination of protocol name, major version number, and minor version number. Note that #equals and #hashCode are defined as final here, they cannot be overridden in derived classes.

Field Summary
protected final  String protocol    Name of the protocol. 
protected final  int major    Major version number of the protocol 
protected final  int minor    Minor version number of the protocol 
Constructor:
 public ProtocolVersion(String protocol,
    int major,
    int minor) 
    Create a protocol version designator.
    Parameters:
    protocol - the name of the protocol, for example "HTTP"
    major - the major version number of the protocol
    minor - the minor version number of the protocol
Method from org.apache.http.ProtocolVersion Summary:
clone,   compareToVersion,   equals,   forVersion,   getMajor,   getMinor,   getProtocol,   greaterEquals,   hashCode,   isComparable,   lessEquals,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.http.ProtocolVersion Detail:
 public Object clone() throws CloneNotSupportedException 
 public int compareToVersion(ProtocolVersion that) 
    Compares this protocol version with another one. Only protocol versions with the same protocol name can be compared. This method does not define a total ordering, as it would be required for java.lang.Comparable .
 public final boolean equals(Object obj) 
    Checks equality of this protocol version with an object. The object is equal if it is a protocl version with the same protocol name, major version number, and minor version number. The specific class of the object is not relevant, instances of derived classes with identical attributes are equal to instances of the base class and vice versa.
 public ProtocolVersion forVersion(int major,
    int minor) 
    Obtains a specific version of this protocol. This can be used by derived classes to instantiate themselves instead of the base class, and to define constants for commonly used versions.
    The default implementation in this class returns this if the version matches, and creates a new ProtocolVersion otherwise.
 public final int getMajor() 
    Returns the major version number of the protocol.
 public final int getMinor() 
    Returns the minor version number of the HTTP protocol.
 public final String getProtocol() 
    Returns the name of the protocol.
 public final boolean greaterEquals(ProtocolVersion version) 
    Tests if this protocol version is greater or equal to the given one.
 public final int hashCode() 
    Obtains a hash code consistent with #equals .
 public boolean isComparable(ProtocolVersion that) 
    Checks whether this protocol can be compared to another one. Only protocol versions with the same protocol name can be compared .
 public final boolean lessEquals(ProtocolVersion version) 
    Tests if this protocol version is less or equal to the given one.
 public String toString() 
    Converts this protocol version to a string.