Skip to content

Commit

Permalink
Expose profile in Result. Partially implements #17
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Todt committed Feb 17, 2020
1 parent 120a4bd commit 10cff9f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/java/com/rethinkdb/model/Profile.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@

public class Profile {

private List<Object> profileObj;
private List<Object> values;

private Profile(List<Object> profileObj) {
this.profileObj = profileObj;
this.values = profileObj;
}

public static @Nullable Profile fromList(List<Object> profileObj) {
if(profileObj == null || profileObj.size() == 0){
public static @Nullable Profile fromList(List<Object> list) {
if(list == null || list.size() == 0){
return null;
}
return new Profile(profileObj);
return new Profile(list);
}

public List<Object> getProfileObj() {
return profileObj;
public List<Object> getValues() {
return values;
}
}
6 changes: 6 additions & 0 deletions src/main/java/com/rethinkdb/net/Result.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import com.rethinkdb.gen.exc.ReqlDriverError;
import com.rethinkdb.gen.exc.ReqlRuntimeError;
import com.rethinkdb.gen.proto.ResponseType;
import com.rethinkdb.model.Profile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.Closeable;
import java.util.Iterator;
Expand Down Expand Up @@ -167,6 +169,10 @@ public Iterator<T> iterator() {
return this;
}

public @Nullable Profile profile() {
return currentResponse.get().profile;
}

protected void handleFirstResponse() {
if (firstRes.isWaitComplete()) {
completed.complete(true);
Expand Down

0 comments on commit 10cff9f

Please sign in to comment.