Skip to content

Commit b0f0a3d

Browse files
committed
Update
1 parent 67f7924 commit b0f0a3d

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

driver/src/main/java/org/neo4j/driver/Config.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import org.neo4j.driver.internal.handlers.pulln.FetchSizeUtil;
3939
import org.neo4j.driver.internal.retry.ExponentialBackoffRetryLogic;
4040
import org.neo4j.driver.net.ServerAddressResolver;
41-
import org.neo4j.driver.querytask.QueryConfig;
4241
import org.neo4j.driver.util.Experimental;
4342
import org.neo4j.driver.util.Immutable;
4443

@@ -129,7 +128,7 @@ private Config(ConfigBuilder builder) {
129128

130129
/**
131130
* A {@link BookmarkManager} implementation for the driver to use on
132-
* {@link Driver#executeQuery(Query, QueryConfig)} method and its variants by default.
131+
* {@link Driver#queryTask(String)} method and its variants by default.
133132
* <p>
134133
* Please note that sessions will not use this automatically, but it is possible to enable it explicitly
135134
* using {@link SessionConfig.Builder#withBookmarkManager(BookmarkManager)}.
@@ -302,7 +301,7 @@ private ConfigBuilder() {}
302301

303302
/**
304303
* Sets a {@link BookmarkManager} implementation for the driver to use on
305-
* {@link Driver#executeQuery(Query, QueryConfig)} method and its variants by default.
304+
* {@link Driver#queryTask(String)} method and its variants by default.
306305
* <p>
307306
* Please note that sessions will not use this automatically, but it is possible to enable it explicitly
308307
* using {@link SessionConfig.Builder#withBookmarkManager(BookmarkManager)}.

driver/src/main/java/org/neo4j/driver/querytask/QueryConfig.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@
2727
import org.neo4j.driver.BookmarkManager;
2828
import org.neo4j.driver.Config;
2929
import org.neo4j.driver.Driver;
30-
import org.neo4j.driver.Query;
3130
import org.neo4j.driver.util.Experimental;
3231

3332
/**
34-
* Query configuration used by {@link Driver#executeQuery(Query, QueryConfig)} and its variants.
33+
* Query configuration used by {@link Driver#queryTask(String)} and its variants.
3534
* @since 5.5
3635
*/
3736
@Experimental
@@ -65,8 +64,8 @@ private QueryConfig(Builder builder) {
6564
}
6665

6766
/**
68-
* Creates a new {@link Builder} used to construct a configuration object with default {@link ResultTransformer}
69-
* implementation returning {@link EagerResult}.
67+
* Creates a new {@link Builder} used to construct a configuration object with default implementation returning
68+
* {@link EagerResult}.
7069
*
7170
* @return a query configuration builder
7271
*/

driver/src/main/java/org/neo4j/driver/querytask/QueryTask.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,20 @@
6868
* }
6969
* </pre>
7070
* <p>
71-
* In addition, it is possible to transform query result by using a provided {@link Collector}.
72-
* Examples:
71+
* In addition, it is possible to transform query result by using a supplied {@link Collector} implementation.
72+
* <p>
73+
* <b>It is strongly recommended to use Cypher query language capabilities where possible</b>. The examples below just
74+
* provide a sample usage of the API.
7375
* <pre>
7476
* {@code
77+
* import static java.util.stream.Collectors.*;
7578
*
79+
* var averagingLong = driver.queryTask("UNWIND range(0, 5) as N RETURN N")
80+
* .execute(averagingLong(record -> record.get("N").asLong()));
81+
* var filteredValues = driver.queryTask("UNWIND range(0, 5) as N RETURN N")
82+
* .execute(mapping(record -> record.get("N").asLong(), filtering(value -> value > 2, toList())));
83+
* var maxValue = driver.queryTask("UNWIND range(0, 5) as N RETURN N")
84+
* .execute(mapping(record -> record.get("N").asLong(), maxBy(Long::compare)));
7685
* }
7786
* </pre>
7887
*

0 commit comments

Comments
 (0)