java.lang.Object | |
↳ | org.apache.http.ProtocolVersion |
Known Direct Subclasses |
Represents a protocol version, as specified in RFC 2616. RFC 2616 specifies only HTTP versions, like "HTTP/1.1" and "HTTP/1.0". RFC 3261 specifies a message format that is identical to HTTP except for the protocol name. It defines a protocol version "SIP/2.0". There are some nitty-gritty differences between the interpretation of versions in HTTP and SIP. In those cases, HTTP takes precedence.
This class defines a protocol version as a combination of
protocol name, major version number, and minor version number.
Note that equals(Object)
and hashCode()
are defined as
final here, they cannot be overridden in derived classes.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
major | Major version number of the protocol | ||||||||||
minor | Minor version number of the protocol | ||||||||||
protocol | Name of the protocol. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a protocol version designator.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates and returns a copy of this
Object .
| |||||||||||
Compares this protocol version with another one.
| |||||||||||
Checks equality of this protocol version with an object.
| |||||||||||
Obtains a specific version of this protocol.
| |||||||||||
Returns the major version number of the protocol.
| |||||||||||
Returns the minor version number of the HTTP protocol.
| |||||||||||
Returns the name of the protocol.
| |||||||||||
Tests if this protocol version is greater or equal to the given one.
| |||||||||||
Obtains a hash code consistent with
equals(Object) .
| |||||||||||
Checks whether this protocol can be compared to another one.
| |||||||||||
Tests if this protocol version is less or equal to the given one.
| |||||||||||
Converts this protocol version to a string.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Create a protocol version designator.
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 |
Creates and returns a copy of this Object
. The default
implementation returns a so-called "shallow" copy: It creates a new
instance of the same class and then copies the field values (including
object references) from this instance to the new instance. A "deep" copy,
in contrast, would also recursively clone nested objects. A subclass that
needs to implement this kind of cloning should call super.clone()
to create the new instance and then create deep copies of the nested,
mutable objects.
CloneNotSupportedException |
---|
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 Comparable
.
that | the protocl version to compare with |
---|
IllegalArgumentException | if the argument has a different protocol name than this object,
or if the argument is null
|
---|
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.
obj | the object to compare with |
---|
true
if the argument is the same protocol version,
false
otherwise
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.
major | the major version |
---|---|
minor | the minor version |
Returns the major version number of the protocol.
Returns the minor version number of the HTTP protocol.
Returns the name of the protocol.
Tests if this protocol version is greater or equal to the given one.
version | the version against which to check this version |
---|
true
if this protocol version is
comparable
to the argument
and compares
as greater or equal,
false
otherwise
Obtains a hash code consistent with equals(Object)
.
Checks whether this protocol can be compared to another one.
Only protocol versions with the same protocol name can be
compared
.
that | the protocol version to consider |
---|
true
if compareToVersion
can be called with the argument, false
otherwise
Tests if this protocol version is less or equal to the given one.
version | the version against which to check this version |
---|
true
if this protocol version is
comparable
to the argument
and compares
as less or equal,
false
otherwise
Converts this protocol version to a string.