Skip to content

Commit

Permalink
Merge pull request #35 from rethinkdb/release-candidate/v2.4.2
Browse files Browse the repository at this point in the history
Release minor version 2.4.2
  • Loading branch information
AdrianTodt authored Mar 26, 2020
2 parents 4a11667 + a8fc2c8 commit f1e1ddb
Show file tree
Hide file tree
Showing 230 changed files with 1,169 additions and 5,299 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/
out/
.gradle/
.#*
*.iml
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
36 changes: 0 additions & 36 deletions src/main/java/com/rethinkdb/RethinkDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,47 +17,11 @@ public class RethinkDB extends TopLevel {
* The Singleton to use to begin interacting with RethinkDB Driver
*/
public static final RethinkDB r = new RethinkDB();

/**
* Jackson's {@link ObjectMapper} for internal JSON handling from and to RethinkDB's internals.
*/
private static ObjectMapper internalMapper;
/**
* Jackson's {@link ObjectMapper} for handling {@link com.rethinkdb.net.Result}'s values.
*/
private static ObjectMapper resultMapper;

/**
* Gets (or creates, if null) the {@link ObjectMapper} for internal JSON handling from and to RethinkDB's internals.
* <br><br>
* <b>WARNING:If you're trying to get or configure the {@link com.rethinkdb.net.Result}'s mapper,
* use {@link RethinkDB#getResultMapper()} instead.</b>
*
* @return the internal {@link ObjectMapper}
*/
public synchronized static @NotNull ObjectMapper getInternalMapper() {
ObjectMapper mapper = internalMapper;
if (mapper == null) {
mapper = new ObjectMapper()
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.enable(DeserializationFeature.USE_LONG_FOR_INTS);
internalMapper = mapper;
}
return mapper;
}

/**
* Sets the {@link ObjectMapper} for internal JSON handling from and to RethinkDB's internals.
* <br><br>
* <b>WARNING:If you're trying to set the {@link com.rethinkdb.net.Result}'s mapper,
* use {@link RethinkDB#setResultMapper(ObjectMapper)} instead.</b>
*
* @param mapper an {@link ObjectMapper}, or null
*/
public synchronized static void setInternalMapper(@Nullable ObjectMapper mapper) {
internalMapper = mapper;
}

/**
* Gets (or creates, if null) the {@link ObjectMapper} for handling {@link com.rethinkdb.net.Result}'s values.
*
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/rethinkdb/ast/Query.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
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.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -49,7 +50,7 @@ public ByteBuffer serialize() {
if (!globalOptions.isEmpty()) {
list.add(ReqlAst.buildOptarg(globalOptions));
}
String json = RethinkDB.getInternalMapper().writeValueAsString(list);
String json = Internals.getInternalMapper().writeValueAsString(list);
byte[] bytes = json.getBytes(StandardCharsets.UTF_8);
ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES + Integer.BYTES + bytes.length)
.order(ByteOrder.LITTLE_ENDIAN)
Expand Down
36 changes: 9 additions & 27 deletions src/main/java/com/rethinkdb/ast/ReqlAst.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import com.rethinkdb.model.OptArgs;
import com.rethinkdb.net.Connection;
import com.rethinkdb.net.Result;
import com.rethinkdb.utils.Types;

import java.lang.reflect.Type;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -95,7 +95,7 @@ public Result<Object> run(Connection conn, Result.FetchMode fetchMode) {
* @return The result of this query
*/
public <T> Result<T> run(Connection conn, Class<T> typeRef) {
return conn.run(this, new OptArgs(), null, new ClassReference<>(typeRef));
return conn.run(this, new OptArgs(), null, Types.of(typeRef));
}

/**
Expand Down Expand Up @@ -135,7 +135,7 @@ public Result<Object> run(Connection conn, OptArgs runOpts, Result.FetchMode fet
* @return The result of this query
*/
public <T> Result<T> run(Connection conn, OptArgs runOpts, Class<T> typeRef) {
return conn.run(this, runOpts, null, new ClassReference<>(typeRef));
return conn.run(this, runOpts, null, Types.of(typeRef));
}

/**
Expand Down Expand Up @@ -163,7 +163,7 @@ public <T> Result<T> run(Connection conn, OptArgs runOpts, TypeReference<T> type
* @return The result of this query
*/
public <T> Result<T> run(Connection conn, Result.FetchMode fetchMode, Class<T> typeRef) {
return conn.run(this, new OptArgs(), fetchMode, new ClassReference<>(typeRef));
return conn.run(this, new OptArgs(), fetchMode, Types.of(typeRef));
}

/**
Expand Down Expand Up @@ -192,7 +192,7 @@ public <T> Result<T> run(Connection conn, Result.FetchMode fetchMode, TypeRefere
* @return The result of this query
*/
public <T> Result<T> run(Connection conn, OptArgs runOpts, Result.FetchMode fetchMode, Class<T> typeRef) {
return conn.run(this, runOpts, fetchMode, new ClassReference<>(typeRef));
return conn.run(this, runOpts, fetchMode, Types.of(typeRef));
}

/**
Expand Down Expand Up @@ -254,7 +254,7 @@ public CompletableFuture<Result<Object>> runAsync(Connection conn, Result.FetchM
* @return The result of this query
*/
public <T> CompletableFuture<Result<T>> runAsync(Connection conn, Class<T> typeRef) {
return conn.runAsync(this, new OptArgs(), null, new ClassReference<>(typeRef));
return conn.runAsync(this, new OptArgs(), null, Types.of(typeRef));
}

/**
Expand Down Expand Up @@ -294,7 +294,7 @@ public CompletableFuture<Result<Object>> runAsync(Connection conn, OptArgs runOp
* @return The result of this query
*/
public <T> CompletableFuture<Result<T>> runAsync(Connection conn, OptArgs runOpts, Class<T> typeRef) {
return conn.runAsync(this, runOpts, null, new ClassReference<>(typeRef));
return conn.runAsync(this, runOpts, null, Types.of(typeRef));
}

/**
Expand Down Expand Up @@ -322,7 +322,7 @@ public <T> CompletableFuture<Result<T>> runAsync(Connection conn, OptArgs runOpt
* @return The result of this query
*/
public <T> CompletableFuture<Result<T>> runAsync(Connection conn, Result.FetchMode fetchMode, Class<T> typeRef) {
return conn.runAsync(this, new OptArgs(), fetchMode, new ClassReference<>(typeRef));
return conn.runAsync(this, new OptArgs(), fetchMode, Types.of(typeRef));
}

/**
Expand Down Expand Up @@ -351,7 +351,7 @@ public <T> CompletableFuture<Result<T>> runAsync(Connection conn, Result.FetchMo
* @return The result of this query
*/
public <T> CompletableFuture<Result<T>> runAsync(Connection conn, OptArgs runOpts, Result.FetchMode fetchMode, Class<T> typeRef) {
return conn.runAsync(this, runOpts, fetchMode, new ClassReference<>(typeRef));
return conn.runAsync(this, runOpts, fetchMode, Types.of(typeRef));
}

/**
Expand Down Expand Up @@ -438,22 +438,4 @@ private void astToString(StringBuilder builder, String name, String indent, bool
}
}
}

/**
* A TypeReference that accepts an class instead of compiler type information.
*
* @param <T> the type referred to.
*/
private static class ClassReference<T> extends TypeReference<T> {
private Class<T> c;

ClassReference(Class<T> c) {
this.c = c;
}

@Override
public Type getType() {
return c;
}
}
}
141 changes: 0 additions & 141 deletions src/main/java/com/rethinkdb/ast/Util.java

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/java/com/rethinkdb/gen/ast/Add.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class Add extends ReqlExpr {
public Add(Object arg) {
this(new Arguments(arg), null);
}
public Add(Arguments args){
public Add(Arguments args) {
this(args, null);
}
public Add(Arguments args, OptArgs optargs) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/rethinkdb/gen/ast/And.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class And extends ReqlExpr {
public And(Object arg) {
this(new Arguments(arg), null);
}
public And(Arguments args){
public And(Arguments args) {
this(args, null);
}
public And(Arguments args, OptArgs optargs) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/rethinkdb/gen/ast/Append.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class Append extends ReqlExpr {
public Append(Object arg) {
this(new Arguments(arg), null);
}
public Append(Arguments args){
public Append(Arguments args) {
this(args, null);
}
public Append(Arguments args, OptArgs optargs) {
Expand Down
Loading

0 comments on commit f1e1ddb

Please sign in to comment.