Skip to content

Commit 247873c

Browse files
HBASE-29004 Optimize unnecessary type castings in Scan and Get setter methods.
1 parent 7658672 commit 247873c

2 files changed

Lines changed: 44 additions & 22 deletions

File tree

hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ public Get setTimestamp(long timestamp) {
214214

215215
@Override
216216
public Get setColumnFamilyTimeRange(byte[] cf, long minStamp, long maxStamp) {
217-
return (Get) super.setColumnFamilyTimeRange(cf, minStamp, maxStamp);
217+
super.setColumnFamilyTimeRange(cf, minStamp, maxStamp);
218+
return this;
218219
}
219220

220221
/**
@@ -242,7 +243,8 @@ public Get readVersions(int versions) throws IOException {
242243

243244
@Override
244245
public Get setLoadColumnFamiliesOnDemand(boolean value) {
245-
return (Get) super.setLoadColumnFamiliesOnDemand(value);
246+
super.setLoadColumnFamiliesOnDemand(value);
247+
return this;
246248
}
247249

248250
/**
@@ -476,46 +478,55 @@ public boolean equals(Object obj) {
476478

477479
@Override
478480
public Get setAttribute(String name, byte[] value) {
479-
return (Get) super.setAttribute(name, value);
481+
super.setAttribute(name, value);
482+
return this;
480483
}
481484

482485
@Override
483486
public Get setId(String id) {
484-
return (Get) super.setId(id);
487+
super.setId(id);
488+
return this;
485489
}
486490

487491
@Override
488492
public Get setAuthorizations(Authorizations authorizations) {
489-
return (Get) super.setAuthorizations(authorizations);
493+
super.setAuthorizations(authorizations);
494+
return this;
490495
}
491496

492497
@Override
493498
public Get setACL(Map<String, Permission> perms) {
494-
return (Get) super.setACL(perms);
499+
super.setACL(perms);
500+
return this;
495501
}
496502

497503
@Override
498504
public Get setACL(String user, Permission perms) {
499-
return (Get) super.setACL(user, perms);
505+
super.setACL(user, perms);
506+
return this;
500507
}
501508

502509
@Override
503510
public Get setConsistency(Consistency consistency) {
504-
return (Get) super.setConsistency(consistency);
511+
super.setConsistency(consistency);
512+
return this;
505513
}
506514

507515
@Override
508516
public Get setReplicaId(int Id) {
509-
return (Get) super.setReplicaId(Id);
517+
super.setReplicaId(Id);
518+
return this;
510519
}
511520

512521
@Override
513522
public Get setIsolationLevel(IsolationLevel level) {
514-
return (Get) super.setIsolationLevel(level);
523+
super.setIsolationLevel(level);
524+
return this;
515525
}
516526

517527
@Override
518528
public Get setPriority(int priority) {
519-
return (Get) super.setPriority(priority);
529+
super.setPriority(priority);
530+
return this;
520531
}
521532
}

hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,8 @@ public Scan setTimestamp(long timestamp) {
324324

325325
@Override
326326
public Scan setColumnFamilyTimeRange(byte[] cf, long minStamp, long maxStamp) {
327-
return (Scan) super.setColumnFamilyTimeRange(cf, minStamp, maxStamp);
327+
super.setColumnFamilyTimeRange(cf, minStamp, maxStamp);
328+
return this;
328329
}
329330

330331
/**
@@ -717,7 +718,8 @@ public boolean getAllowPartialResults() {
717718

718719
@Override
719720
public Scan setLoadColumnFamiliesOnDemand(boolean value) {
720-
return (Scan) super.setLoadColumnFamiliesOnDemand(value);
721+
super.setLoadColumnFamiliesOnDemand(value);
722+
return this;
721723
}
722724

723725
/**
@@ -847,47 +849,56 @@ public boolean isRaw() {
847849

848850
@Override
849851
public Scan setAttribute(String name, byte[] value) {
850-
return (Scan) super.setAttribute(name, value);
852+
super.setAttribute(name, value);
853+
return this;
851854
}
852855

853856
@Override
854857
public Scan setId(String id) {
855-
return (Scan) super.setId(id);
858+
super.setId(id);
859+
return this;
856860
}
857861

858862
@Override
859863
public Scan setAuthorizations(Authorizations authorizations) {
860-
return (Scan) super.setAuthorizations(authorizations);
864+
super.setAuthorizations(authorizations);
865+
return this;
861866
}
862867

863868
@Override
864869
public Scan setACL(Map<String, Permission> perms) {
865-
return (Scan) super.setACL(perms);
870+
super.setACL(perms);
871+
return this;
866872
}
867873

868874
@Override
869875
public Scan setACL(String user, Permission perms) {
870-
return (Scan) super.setACL(user, perms);
876+
super.setACL(user, perms);
877+
return this;
871878
}
872879

873880
@Override
874881
public Scan setConsistency(Consistency consistency) {
875-
return (Scan) super.setConsistency(consistency);
882+
super.setConsistency(consistency);
883+
return this;
876884
}
877885

878886
@Override
879887
public Scan setReplicaId(int Id) {
880-
return (Scan) super.setReplicaId(Id);
888+
super.setReplicaId(Id);
889+
return this;
881890
}
882891

883892
@Override
884893
public Scan setIsolationLevel(IsolationLevel level) {
885-
return (Scan) super.setIsolationLevel(level);
894+
super.setIsolationLevel(level);
895+
return this;
886896
}
887897

888898
@Override
889899
public Scan setPriority(int priority) {
890-
return (Scan) super.setPriority(priority);
900+
super.setPriority(priority);
901+
return this;
891902
}
892903

893904
/**

0 commit comments

Comments
 (0)