codec-http: Document the semantics of HttpResponseStatus equality and comparison

This commit is contained in:
Josh Hoyt 2014-05-21 12:26:05 -07:00 committed by Norman Maurer
parent 350ac9787e
commit 0a4cade36a

View File

@ -499,14 +499,14 @@ public class HttpResponseStatus implements Comparable<HttpResponseStatus> {
}
/**
* Returns the code of this getStatus.
* Returns the code of this {@link HttpResponseStatus}.
*/
public int code() {
return code;
}
/**
* Returns the reason phrase of this getStatus.
* Returns the reason phrase of this {@link HttpResponseStatus}.
*/
public String reasonPhrase() {
return reasonPhrase;
@ -517,6 +517,10 @@ public class HttpResponseStatus implements Comparable<HttpResponseStatus> {
return code();
}
/**
* Equality of {@link HttpResponseStatus} only depends on {@link #code()}. The
* reason phrase is not considered for equality.
*/
@Override
public boolean equals(Object o) {
if (!(o instanceof HttpResponseStatus)) {
@ -526,6 +530,10 @@ public class HttpResponseStatus implements Comparable<HttpResponseStatus> {
return code() == ((HttpResponseStatus) o).code();
}
/**
* Equality of {@link HttpResponseStatus} only depends on {@link #code()}. The
* reason phrase is not considered for equality.
*/
@Override
public int compareTo(HttpResponseStatus o) {
return code() - o.code();