Skip to content

Commit

Permalink
Merge pull request #573 from mziccard/rename-equals
Browse files Browse the repository at this point in the history
Rename equals and hashCode in base abstract classes
  • Loading branch information
aozarov committed Jan 22, 2016
2 parents 3f7626d + e11a5ae commit 0556813
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 25 deletions.
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

0 comments on commit 0556813

Please sign in to comment.