Merge pull request #958 from jclouds/apply-java-7-fix-to-1.5.x

Implement Comparable in GoGrid ErrorResponse
This commit is contained in:
Adrian Cole 2012-11-04 17:24:24 -08:00
commit 691152c3d8
1 changed files with 10 additions and 1 deletions

View File

@ -24,13 +24,14 @@ import java.beans.ConstructorProperties;
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.ComparisonChain;
/**
* Class ErrorResponse
*
* @author Oleksiy Yarmula
*/
public class ErrorResponse {
public class ErrorResponse implements Comparable<ErrorResponse> {
public static Builder<?> builder() {
return new ConcreteBuilder();
@ -113,6 +114,14 @@ public class ErrorResponse {
&& Objects.equal(this.errorCode, that.errorCode);
}
@Override
public int compareTo(ErrorResponse that) {
return ComparisonChain.start()
.compare(errorCode, that.errorCode)
.compare(message, that.message)
.result();
}
protected ToStringHelper string() {
return Objects.toStringHelper(this)
.add("message", message).add("errorCode", errorCode);