Methods Summary |
---|
public java.lang.Object | clone()
return super.clone();
|
public int | compareToVersion(org.apache.http.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 {@link java.lang.Comparable}.
if (that == null) {
throw new IllegalArgumentException
("Protocol version must not be null.");
}
if (!this.protocol.equals(that.protocol)) {
throw new IllegalArgumentException
("Versions for different protocols cannot be compared. " +
this + " " + that);
}
int delta = getMajor() - that.getMajor();
if (delta == 0) {
delta = getMinor() - that.getMinor();
}
return delta;
|
public final boolean | equals(java.lang.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.
if (this == obj) {
return true;
}
if (!(obj instanceof ProtocolVersion)) {
return false;
}
ProtocolVersion that = (ProtocolVersion) obj;
return ((this.protocol.equals(that.protocol)) &&
(this.major == that.major) &&
(this.minor == that.minor));
|
public org.apache.http.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 {@link ProtocolVersion}
otherwise.
if ((major == this.major) && (minor == this.minor)) {
return this;
}
// argument checking is done in the constructor
return new ProtocolVersion(this.protocol, major, minor);
|
public final int | getMajor()Returns the major version number of the protocol.
return major;
|
public final int | getMinor()Returns the minor version number of the HTTP protocol.
return minor;
|
public final java.lang.String | getProtocol()Returns the name of the protocol.
return protocol;
|
public final boolean | greaterEquals(org.apache.http.ProtocolVersion version)Tests if this protocol version is greater or equal to the given one.
return isComparable(version) && (compareToVersion(version) >= 0);
|
public final int | hashCode()Obtains a hash code consistent with {@link #equals}.
return this.protocol.hashCode() ^ (this.major * 100000) ^ this.minor;
|
public boolean | isComparable(org.apache.http.ProtocolVersion that)Checks whether this protocol can be compared to another one.
Only protocol versions with the same protocol name can be
{@link #compareToVersion compared}.
return (that != null) && this.protocol.equals(that.protocol);
|
public final boolean | lessEquals(org.apache.http.ProtocolVersion version)Tests if this protocol version is less or equal to the given one.
return isComparable(version) && (compareToVersion(version) <= 0);
|
public java.lang.String | toString()Converts this protocol version to a string.
CharArrayBuffer buffer = new CharArrayBuffer(16);
buffer.append(this.protocol);
buffer.append('/");
buffer.append(Integer.toString(this.major));
buffer.append('.");
buffer.append(Integer.toString(this.minor));
return buffer.toString();
|