Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ virtualenv/

# RethinkDB
scripts/*.proto
test-dburl-override.txt

# Editors
.vscode/
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Maven Central](https://img.shields.io/maven-central/v/com.rethinkdb/rethinkdb-driver)](https://search.maven.org/artifact/com.rethinkdb/rethinkdb-driver)
[![Bintray](https://img.shields.io/bintray/v/rethinkdb/maven/rethinkdb-driver)](https://bintray.com/rethinkdb/maven/rethinkdb-driver/_latestVersion)
[![License](https://img.shields.io/github/license/rethinkdb/rethinkdb-java?color=lightgrey)](https://github.com/rethinkdb/rethinkdb-java/tree/master/LICENSE)
[![Travis-CI.org](https://img.shields.io/travis/rethinkdb/rethinkdb-java)](https://travis-ci.org/rethinkdb/rethinkdb-java)
[![Twitter](https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Fgithub.com%2Frethinkdb%2Frethinkdb-java)](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2Frethinkdb%2Frethinkdb-java)

Expand All @@ -23,14 +24,18 @@ Run `./gradlew assemble` to build the jar or `./gradlew install` to install it i

## Contributing to the driver

If you want to contribute to the driver, make sure to base your branch off of our **develop** branch (or a feature-branch)
and create your PR into that **same** branch. **We will be rejecting any PRs between branches or into release branches!**
It is very possible that your change might already be in development or you missed something.

### Installation

Besides JDK 8, to be able to contribute to the driver, you must also install:

* Python **3.6** or **3.7**
* PIP3 libraries:
* mako
* rethinkdb
* `mako`
* `rethinkdb`

### Using Gradle

Expand Down Expand Up @@ -105,6 +110,4 @@ These are also checked into git, so you don't need to run the conversion script

This section was moved to separate documentation:

> [How to deploy this repository to Bintray](DEPLOYING-BINTRAY.md)

> [How to deploy this repository to Maven Central (Sonatype)](DEPLOYING-SONATYPE.md)
> [How to deploy this repository to Bintray with integration with Maven Central (Sonatype)](DEPLOYING.md)
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ plugins {
id("com.jfrog.bintray") version "1.8.4"
}

version = "2.4.1.1"
version = "2.4.2"
group = "com.rethinkdb"

java.sourceCompatibility = JavaVersion.VERSION_1_8
Expand Down
23 changes: 17 additions & 6 deletions src/main/java/com/rethinkdb/RethinkDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
public class RethinkDB extends TopLevel {
/**
* The Singleton to use to begin interacting with RethinkDB Driver
* The Singleton to use to begin interacting with RethinkDB Driver.
*/
public static final RethinkDB r = new RethinkDB();
/**
Expand All @@ -25,7 +25,7 @@ public class RethinkDB extends TopLevel {
/**
* Gets (or creates, if null) the {@link ObjectMapper} for handling {@link com.rethinkdb.net.Result}'s values.
*
* @return the {@link com.rethinkdb.net.Result}'s {@link ObjectMapper}
* @return the {@link com.rethinkdb.net.Result}'s {@link ObjectMapper}.
*/
public synchronized static @NotNull ObjectMapper getResultMapper() {
ObjectMapper mapper = resultMapper;
Expand All @@ -40,7 +40,7 @@ public class RethinkDB extends TopLevel {
/**
* Sets the {@link ObjectMapper} for handling {@link com.rethinkdb.net.Result}'s values.
*
* @param mapper an {@link ObjectMapper}, or null
* @param mapper an {@link ObjectMapper}, or null.
*/
public synchronized static void setResultMapper(@Nullable ObjectMapper mapper) {
resultMapper = mapper;
Expand All @@ -49,7 +49,7 @@ public synchronized static void setResultMapper(@Nullable ObjectMapper mapper) {
/**
* Creates a new connection builder.
*
* @return a newly created {@link Connection.Builder}
* @return a newly created {@link Connection.Builder}.
*/
public @NotNull Connection.Builder connection() {
return new Connection.Builder();
Expand All @@ -59,7 +59,7 @@ public synchronized static void setResultMapper(@Nullable ObjectMapper mapper) {
* Creates a new connection builder and configures it with a db-url.
*
* @param dburl the db-url to configure the builder.
* @return a newly created {@link Connection.Builder}
* @return a newly created {@link Connection.Builder}.
*/
public @NotNull Connection.Builder connection(@NotNull String dburl) {
return connection(URI.create(dburl));
Expand All @@ -69,9 +69,20 @@ public synchronized static void setResultMapper(@Nullable ObjectMapper mapper) {
* Creates a new connection builder and configures it with a db-url.
*
* @param uri the db-url to configure the builder.
* @return a newly created {@link Connection.Builder}
* @return a newly created {@link Connection.Builder}.
*/
public @NotNull Connection.Builder connection(@NotNull URI uri) {
return new Connection.Builder(uri);
}

/**
* Copies a connection builder.
*
* @param b the original builder.
* @return a copy of the {@link Connection.Builder}.
*/
public @NotNull Connection.Builder connection(Connection.Builder b) {
return new Connection.Builder(b);
}

}
17 changes: 8 additions & 9 deletions src/main/java/com/rethinkdb/ast/Query.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.rethinkdb.ast;

import com.rethinkdb.RethinkDB;
import com.rethinkdb.gen.exc.ReqlRuntimeError;
import com.rethinkdb.gen.proto.QueryType;
import com.rethinkdb.model.OptArgs;
import com.rethinkdb.utils.Internals;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -22,21 +22,20 @@
public class Query {
private static final Logger LOGGER = LoggerFactory.getLogger(Query.class);

public final QueryType type;
public final @NotNull QueryType type;
public final long token;
public final OptArgs globalOptions;

public final @Nullable ReqlAst term;
public final @Nullable OptArgs globalOptions;

public Query(QueryType type, long token, @Nullable ReqlAst term, OptArgs globalOptions) {
public Query(@NotNull QueryType type, long token, @Nullable ReqlAst term, @Nullable OptArgs globalOptions) {
this.type = type;
this.token = token;
this.term = term;
this.globalOptions = globalOptions;
}

public Query(QueryType type, long token) {
this(type, token, null, new OptArgs());
public Query(@NotNull QueryType type, long token) {
this(type, token, null, null);
}

public ByteBuffer serialize() {
Expand All @@ -47,8 +46,8 @@ public ByteBuffer serialize() {
if (term != null) {
list.add(term.build());
}
if (!globalOptions.isEmpty()) {
list.add(ReqlAst.buildOptarg(globalOptions));
if (globalOptions != null && !globalOptions.isEmpty()) {
list.add(ReqlAst.buildToMap(globalOptions));
}
String json = Internals.getInternalMapper().writeValueAsString(list);
byte[] bytes = json.getBytes(StandardCharsets.UTF_8);
Expand Down
Loading