|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.http.ProtocolVersion
@Contract(threading=IMMUTABLE) public class ProtocolVersion
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(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 String |
protocol
Name of the protocol. |
| Constructor Summary | |
|---|---|
ProtocolVersion(String protocol,
int major,
int minor)
Create a protocol version designator. |
|
| Method Summary | |
|---|---|
Object |
clone()
|
int |
compareToVersion(ProtocolVersion that)
Compares this protocol version with another one. |
boolean |
equals(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. |
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. |
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 String protocol
protected final int major
protected final int minor
| Constructor Detail |
|---|
public ProtocolVersion(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 protocol| Method Detail |
|---|
public final String getProtocol()
public final int getMajor()
public final int getMinor()
public ProtocolVersion forVersion(int major,
int minor)
The default implementation in this class returns 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 Objectpublic final boolean equals(Object obj)
equals in class Objectobj - 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 protocol version to compare with
IllegalArgumentException - if the argument has a different protocol name than this object,
or if the argument is nullpublic 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 String toString()
toString in class Object
public Object clone()
throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||