Skip to content

Commit

Permalink
Implements comments by @aozarov.
Browse files Browse the repository at this point in the history
  • Loading branch information
mderka committed Jan 30, 2016
1 parent 465f532 commit a8bee9c
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 177 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@
import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.base.MoreObjects;
import com.google.gcloud.spi.DnsServiceRpc;
import com.google.gcloud.spi.DnsRpc;

import java.io.Serializable;
import java.util.Objects;

/**
* A base class for options.
*/
public abstract class AbstractOption implements Serializable {
abstract class AbstractOption implements Serializable {

private static final long serialVersionUID = 201601261704L;
private static final long serialVersionUID = -5912727967831484228L;
private final Object value;
private final DnsServiceRpc.Option rpcOption;
private final DnsRpc.Option rpcOption;

AbstractOption(DnsServiceRpc.Option rpcOption, Object value) {
AbstractOption(DnsRpc.Option rpcOption, Object value) {
this.rpcOption = checkNotNull(rpcOption);
this.value = value;
}
Expand All @@ -42,7 +42,7 @@ Object value() {
return value;
}

DnsServiceRpc.Option rpcOption() {
DnsRpc.Option rpcOption() {
return rpcOption;
}

Expand All @@ -52,18 +52,19 @@ public boolean equals(Object obj) {
return false;
}
AbstractOption other = (AbstractOption) obj;
return Objects.equals(value, other.value);
return Objects.equals(value, other.value) && Objects.equals(rpcOption, other.rpcOption);
}

@Override
public int hashCode() {
return Objects.hash(value);
return Objects.hash(value, rpcOption);
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("value", value)
.add("rpcOption", rpcOption)
.toString();
}
}
Loading

0 comments on commit a8bee9c

Please sign in to comment.