99import com .rethinkdb .model .OptArgs ;
1010import com .rethinkdb .net .Connection ;
1111import com .rethinkdb .net .Result ;
12+ import com .rethinkdb .utils .Types ;
1213
13- import java .lang .reflect .Type ;
1414import java .util .*;
1515import java .util .Map .Entry ;
1616import java .util .concurrent .CompletableFuture ;
@@ -95,7 +95,7 @@ public Result<Object> run(Connection conn, Result.FetchMode fetchMode) {
9595 * @return The result of this query
9696 */
9797 public <T > Result <T > run (Connection conn , Class <T > typeRef ) {
98- return conn .run (this , new OptArgs (), null , new ClassReference <> (typeRef ));
98+ return conn .run (this , new OptArgs (), null , Types . of (typeRef ));
9999 }
100100
101101 /**
@@ -135,7 +135,7 @@ public Result<Object> run(Connection conn, OptArgs runOpts, Result.FetchMode fet
135135 * @return The result of this query
136136 */
137137 public <T > Result <T > run (Connection conn , OptArgs runOpts , Class <T > typeRef ) {
138- return conn .run (this , runOpts , null , new ClassReference <> (typeRef ));
138+ return conn .run (this , runOpts , null , Types . of (typeRef ));
139139 }
140140
141141 /**
@@ -163,7 +163,7 @@ public <T> Result<T> run(Connection conn, OptArgs runOpts, TypeReference<T> type
163163 * @return The result of this query
164164 */
165165 public <T > Result <T > run (Connection conn , Result .FetchMode fetchMode , Class <T > typeRef ) {
166- return conn .run (this , new OptArgs (), fetchMode , new ClassReference <> (typeRef ));
166+ return conn .run (this , new OptArgs (), fetchMode , Types . of (typeRef ));
167167 }
168168
169169 /**
@@ -192,7 +192,7 @@ public <T> Result<T> run(Connection conn, Result.FetchMode fetchMode, TypeRefere
192192 * @return The result of this query
193193 */
194194 public <T > Result <T > run (Connection conn , OptArgs runOpts , Result .FetchMode fetchMode , Class <T > typeRef ) {
195- return conn .run (this , runOpts , fetchMode , new ClassReference <> (typeRef ));
195+ return conn .run (this , runOpts , fetchMode , Types . of (typeRef ));
196196 }
197197
198198 /**
@@ -254,7 +254,7 @@ public CompletableFuture<Result<Object>> runAsync(Connection conn, Result.FetchM
254254 * @return The result of this query
255255 */
256256 public <T > CompletableFuture <Result <T >> runAsync (Connection conn , Class <T > typeRef ) {
257- return conn .runAsync (this , new OptArgs (), null , new ClassReference <> (typeRef ));
257+ return conn .runAsync (this , new OptArgs (), null , Types . of (typeRef ));
258258 }
259259
260260 /**
@@ -294,7 +294,7 @@ public CompletableFuture<Result<Object>> runAsync(Connection conn, OptArgs runOp
294294 * @return The result of this query
295295 */
296296 public <T > CompletableFuture <Result <T >> runAsync (Connection conn , OptArgs runOpts , Class <T > typeRef ) {
297- return conn .runAsync (this , runOpts , null , new ClassReference <> (typeRef ));
297+ return conn .runAsync (this , runOpts , null , Types . of (typeRef ));
298298 }
299299
300300 /**
@@ -322,7 +322,7 @@ public <T> CompletableFuture<Result<T>> runAsync(Connection conn, OptArgs runOpt
322322 * @return The result of this query
323323 */
324324 public <T > CompletableFuture <Result <T >> runAsync (Connection conn , Result .FetchMode fetchMode , Class <T > typeRef ) {
325- return conn .runAsync (this , new OptArgs (), fetchMode , new ClassReference <> (typeRef ));
325+ return conn .runAsync (this , new OptArgs (), fetchMode , Types . of (typeRef ));
326326 }
327327
328328 /**
@@ -351,7 +351,7 @@ public <T> CompletableFuture<Result<T>> runAsync(Connection conn, Result.FetchMo
351351 * @return The result of this query
352352 */
353353 public <T > CompletableFuture <Result <T >> runAsync (Connection conn , OptArgs runOpts , Result .FetchMode fetchMode , Class <T > typeRef ) {
354- return conn .runAsync (this , runOpts , fetchMode , new ClassReference <> (typeRef ));
354+ return conn .runAsync (this , runOpts , fetchMode , Types . of (typeRef ));
355355 }
356356
357357 /**
@@ -438,22 +438,4 @@ private void astToString(StringBuilder builder, String name, String indent, bool
438438 }
439439 }
440440 }
441-
442- /**
443- * A TypeReference that accepts an class instead of compiler type information.
444- *
445- * @param <T> the type referred to.
446- */
447- private static class ClassReference <T > extends TypeReference <T > {
448- private Class <T > c ;
449-
450- ClassReference (Class <T > c ) {
451- this .c = c ;
452- }
453-
454- @ Override
455- public Type getType () {
456- return c ;
457- }
458- }
459441}
0 commit comments