Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename equals and hashCode in base abstract classes #573

Merged
merged 2 commits into from
Jan 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -386,14 +386,12 @@ public String toString() {
return toStringHelper().toString();
}

@Override
public int hashCode() {
protected final int baseHashCode() {
return Objects.hash(tableId);
}

@Override
public boolean equals(Object obj) {
return obj instanceof BaseTableInfo && Objects.equals(toPb(), ((BaseTableInfo) obj).toPb());
protected final boolean baseEquals(BaseTableInfo tableInfo) {
return Objects.equals(toPb(), tableInfo.toPb());
}

Table toPb() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,12 @@ ToStringHelper toStringHelper() {

@Override
public boolean equals(Object obj) {
return obj instanceof CopyJobInfo && Objects.equals(toPb(), ((CopyJobInfo) obj).toPb());
return obj instanceof CopyJobInfo && baseEquals((CopyJobInfo) obj);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), sourceTables, destinationTable, createDisposition,
return Objects.hash(baseHashCode(), sourceTables, destinationTable, createDisposition,
writeDisposition);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,12 @@ ToStringHelper toStringHelper() {

@Override
public boolean equals(Object obj) {
return obj instanceof ExternalTableInfo
&& Objects.equals(toPb(), ((ExternalTableInfo) obj).toPb());
return obj instanceof ExternalTableInfo && baseEquals((ExternalTableInfo) obj);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), configuration);
return Objects.hash(baseHashCode(), configuration);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,12 @@ ToStringHelper toStringHelper() {

@Override
public boolean equals(Object obj) {
return obj instanceof ExtractJobInfo && Objects.equals(toPb(), ((ExtractJobInfo) obj).toPb());
return obj instanceof ExtractJobInfo && baseEquals((ExtractJobInfo) obj);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), sourceTable, destinationUris, printHeader, fieldDelimiter,
return Objects.hash(baseHashCode(), sourceTable, destinationUris, printHeader, fieldDelimiter,
format, compression);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,12 @@ public String toString() {
return toStringHelper().toString();
}

@Override
public int hashCode() {
protected final int baseHashCode() {
return Objects.hash(jobId);
}

@Override
public boolean equals(Object obj) {
return obj instanceof JobInfo && Objects.equals(toPb(), ((JobInfo) obj).toPb());
protected final boolean baseEquals(JobInfo jobInfo) {
return Objects.equals(toPb(), jobInfo.toPb());
}

Job toPb() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ ToStringHelper toStringHelper() {

@Override
public boolean equals(Object obj) {
return obj instanceof LoadJobInfo && Objects.equals(toPb(), ((LoadJobInfo) obj).toPb());
return obj instanceof LoadJobInfo && baseEquals((LoadJobInfo) obj);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), sourceUris, configuration);
return Objects.hash(baseHashCode(), sourceUris, configuration);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,12 +447,12 @@ ToStringHelper toStringHelper() {

@Override
public boolean equals(Object obj) {
return obj instanceof QueryJobInfo && Objects.equals(toPb(), ((QueryJobInfo) obj).toPb());
return obj instanceof QueryJobInfo && baseEquals((QueryJobInfo) obj);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), allowLargeResults, createDisposition, destinationTable,
return Objects.hash(baseHashCode(), allowLargeResults, createDisposition, destinationTable,
defaultDataset, flattenResults, priority, query, tableDefinitions, useQueryCache,
userDefinedFunctions, writeDisposition, dryRun);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,12 @@ ToStringHelper toStringHelper() {

@Override
public boolean equals(Object obj) {
return obj instanceof TableInfo && Objects.equals(toPb(), ((TableInfo) obj).toPb());
return obj instanceof TableInfo && baseEquals((TableInfo) obj);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), location, streamingBuffer);
return Objects.hash(baseHashCode(), location, streamingBuffer);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ ToStringHelper toStringHelper() {

@Override
public boolean equals(Object obj) {
return obj instanceof ViewInfo && Objects.equals(toPb(), ((ViewInfo) obj).toPb());
return obj instanceof ViewInfo && baseEquals((ViewInfo) obj);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), query, userDefinedFunctions);
return Objects.hash(baseHashCode(), query, userDefinedFunctions);
}

@Override
Expand Down