|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.http.ProtocolVersion
public class ProtocolVersion
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(java.lang.Object)
and hashCode()
are defined as
final here, they cannot be overridden in derived classes.
Field Summary | |
---|---|
protected int |
major
Major version number of the protocol |
protected int |
minor
Minor version number of the protocol |
protected java.lang.String |
protocol
Name of the protocol. |
Constructor Summary | |
---|---|
ProtocolVersion(java.lang.String protocol,
int major,
int minor)
Create a protocol version designator. |
Method Summary | |
---|---|
java.lang.Object |
clone()
|
int |
compareToVersion(ProtocolVersion that)
Compares this protocol version with another one. |
boolean |
equals(java.lang.Object obj)
Checks equality of this protocol version with an object. |
ProtocolVersion |
forVersion(int major,
int minor)
Obtains a specific version of this protocol. |
int |
getMajor()
Returns the major version number of the protocol. |
int |
getMinor()
Returns the minor version number of the HTTP protocol. |
java.lang.String |
getProtocol()
Returns the name of the protocol. |
boolean |
greaterEquals(ProtocolVersion version)
Tests if this protocol version is greater or equal to the given one. |
int |
hashCode()
Obtains a hash code consistent with equals(java.lang.Object) . |
boolean |
isComparable(ProtocolVersion that)
Checks whether this protocol can be compared to another one. |
boolean |
lessEquals(ProtocolVersion version)
Tests if this protocol version is less or equal to the given one. |
java.lang.String |
toString()
Converts this protocol version to a string. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final java.lang.String protocol
protected final int major
protected final int minor
Constructor Detail |
---|
public ProtocolVersion(java.lang.String protocol, int major, int minor)
protocol
- the name of the protocol, for example "HTTP"major
- the major version number of the protocolminor
- the minor version number of the protocolMethod Detail |
---|
public final java.lang.String getProtocol()
public final int getMajor()
public final int getMinor()
public ProtocolVersion forVersion(int major, int minor)
this
if the version matches, and creates a new ProtocolVersion
otherwise.
major
- the major versionminor
- the minor version
public final int hashCode()
equals(java.lang.Object)
.
hashCode
in class java.lang.Object
public final boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to compare with
true
if the argument is the same protocol version,
false
otherwisepublic boolean isComparable(ProtocolVersion that)
compared
.
that
- the protocol version to consider
true
if compareToVersion
can be called with the argument, false
otherwisepublic int compareToVersion(ProtocolVersion that)
Comparable
.
that
- the protocl version to compare with
java.lang.IllegalArgumentException
- if the argument has a different protocol name than this object,
or if the argument is null
public final boolean greaterEquals(ProtocolVersion version)
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
otherwisepublic final boolean lessEquals(ProtocolVersion version)
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
otherwisepublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |