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.
| Modifier and Type | Field and Description |
|---|---|
| private final int | major
Major version number of the protocol |
| private final int | minor
Minor version number of the protocol |
| private final String | protocol
Name of the protocol. |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public | ProtocolVersion(final String
the name of the protocol, for example "HTTP" protocol, final int the major version number of the protocol major, final int the minor version number of the protocol minor)Create a protocol version designator. |
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: a negative integer, zero, or a positive integer as this version is less than, equal to, or greater than the argument version.the protocol version to compare with that)Compares this protocol version with another one. |
| public final boolean | Returns: whether this instance has the same major and minor version as the arguments.the major version to check. major, final int the minor version to check. minor)Checks whether this instance has the same major and minor version as the arguments. |
| public final boolean | Returns: true if the argument is the same protocol version,
false otherwisethe object to compare with obj)Overrides java. |
| public String | Returns: a protocol version string, like "HTTP/1.1"Formats this protocol version as a string. |
| public final int | |
| public final int | |
| public final String | |
| public final boolean | Returns: true if this protocol version is
comparable to the argument
and compares as greater or equal,
false otherwisethe version against which to check this version version)Tests if this protocol version is greater or equal to the given one. |
| public final int | Returns: the hashcode of this protocol versionOverrides java. equals.
|
| public boolean | isComparable(final ProtocolVersion
the protocol version to consider that)Checks whether this protocol can be compared to another one. |
| public final boolean | Returns: true if this protocol version is
comparable to the argument
and compares as less or equal,
false otherwisethe version against which to check this version version)Tests if this protocol version is less or equal to the given one. |
| public String | Returns: a protocol version string, like "HTTP/1.1"Overrides java. |
| major | back to summary |
|---|---|
| private final int major Major version number of the protocol | |
| minor | back to summary |
|---|---|
| private final int minor Minor version number of the protocol | |
| protocol | back to summary |
|---|---|
| private final String protocol Name of the protocol. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| ProtocolVersion | back to summary |
|---|---|
| public ProtocolVersion(final String protocol, final int major, final int minor) Create a protocol version designator.
| |
| compareToVersion | back to summary |
|---|---|
| public int compareToVersion(final 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
| |
| equals | back to summary |
|---|---|
| public final boolean equals(final int major, final int minor) Checks whether this instance has the same major and minor version as the arguments.
| |
| equals | back to summary |
|---|---|
| public final boolean equals(final Object obj) Overrides java. Checks equality of this protocol version with an object. The object is equal if it is a protocol 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. | |
| format | back to summary |
|---|---|
| public String format() Formats this protocol version as a string.
| |
| getMajor | back to summary |
|---|---|
| public final int getMajor() Returns the major version number of the protocol.
| |
| getMinor | back to summary |
|---|---|
| public final int getMinor() Returns the minor version number of the HTTP protocol.
| |
| getProtocol | back to summary |
|---|---|
| public final String getProtocol() Returns the name of the protocol.
| |
| greaterEquals | back to summary |
|---|---|
| public final boolean greaterEquals(final ProtocolVersion version) Tests if this protocol version is greater or equal to the given one.
| |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Overrides java. Obtains a hash code consistent with
| |
| isComparable | back to summary |
|---|---|
| public boolean isComparable(final ProtocolVersion that) Checks whether this protocol can be compared to another one.
Only protocol versions with the same protocol name can be
| |
| lessEquals | back to summary |
|---|---|
| public final boolean lessEquals(final ProtocolVersion version) Tests if this protocol version is less or equal to the given one.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Converts this protocol version to a string. | |