Skip to content

Commit 0d0c95a

Browse files
authored
Merge pull request #659 from martin-neotech/4.0-docs-update-2
Docs fixes for 4.0
2 parents 97e4945 + 7c8ffeb commit 0d0c95a

File tree

14 files changed

+42
-48
lines changed

14 files changed

+42
-48
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public interface QueryRunner
8080
* <pre class="doctest:QueryRunnerDocIT#parameterTest">
8181
* {@code
8282
*
83-
* Result result = session.run( "MATCH (n) WHERE n.name = {myNameParam} RETURN (n)",
83+
* Result result = session.run( "MATCH (n) WHERE n.name = $myNameParam RETURN (n)",
8484
* Values.parameters( "myNameParam", "Bob" ) );
8585
* }
8686
* </pre>
@@ -110,7 +110,7 @@ public interface QueryRunner
110110
* Map<String, Object> parameters = new HashMap<String, Object>();
111111
* parameters.put("myNameParam", "Bob");
112112
*
113-
* Result result = session.run( "MATCH (n) WHERE n.name = {myNameParam} RETURN (n)",
113+
* Result result = session.run( "MATCH (n) WHERE n.name = $myNameParam RETURN (n)",
114114
* parameters );
115115
* }
116116
* </pre>
@@ -152,7 +152,7 @@ public interface QueryRunner
152152
* <pre class="doctest:QueryRunnerDocIT#queryObjectTest">
153153
* {@code
154154
*
155-
* Query query = new Query( "MATCH (n) WHERE n.name=$myNameParam RETURN n.age" );
155+
* Query query = new Query( "MATCH (n) WHERE n.name = $myNameParam RETURN n.age" );
156156
* Result result = session.run( query.withParameters( Values.parameters( "myNameParam", "Bob" ) ) );
157157
* }
158158
* </pre>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
* sessions should be used when an application requires multiple concurrent
5151
* threads of database work to be carried out.
5252
*
53-
* @since 1.0 (Removed async API to {@link AsyncSession} in 2.0)
53+
* @since 1.0 (Removed async API to {@link AsyncSession} in 4.0)
5454
*/
5555
public interface Session extends Resource, QueryRunner
5656
{
@@ -176,7 +176,7 @@ public interface Session extends Resource, QueryRunner
176176
* Map<String, Object> parameters = new HashMap<>();
177177
* parameters.put("myNameParam", "Bob");
178178
*
179-
* Result result = session.run("MATCH (n) WHERE n.name = {myNameParam} RETURN (n)", parameters, config);
179+
* Result result = session.run("MATCH (n) WHERE n.name = $myNameParam RETURN (n)", parameters, config);
180180
* }
181181
* </pre>
182182
*
@@ -201,7 +201,7 @@ public interface Session extends Resource, QueryRunner
201201
* .withMetadata(metadata)
202202
* .build();
203203
*
204-
* Query query = new Query("MATCH (n) WHERE n.name=$myNameParam RETURN n.age");
204+
* Query query = new Query("MATCH (n) WHERE n.name = $myNameParam RETURN n.age");
205205
* Result result = session.run(query.withParameters(Values.parameters("myNameParam", "Bob")));
206206
* }
207207
* </pre>

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

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
* which ensures in case of any error in try block, the transaction is
2929
* automatically rolled back on close. Note that <code>ROLLBACK</code> is the
3030
* default action unless {@link #commit()} is called before closing.
31-
* {@code
31+
* <pre>{@code
3232
* try(Transaction tx = session.beginTransaction())
3333
* {
34-
* tx.run("CREATE (a:Person {name: {x}})", parameters("x", "Alice"));
34+
* tx.run("CREATE (a:Person {name: $name})", parameters("name", "Alice"));
3535
* tx.commit();
3636
* }
37-
* }
37+
* }</pre>
3838
* Blocking calls are: {@link #commit()}, {@link #rollback()}, {@link #close()}
3939
* and various overloads of {@link #run(Query)}.
4040
*
@@ -53,16 +53,14 @@ public interface Transaction extends Resource, QueryRunner
5353
* You must call this method before calling {@link #close()} to have your transaction committed.
5454
* If a transaction is not committed or rolled back before close,
5555
* the transaction will be rolled back by default in {@link #close}.
56-
*
57-
Example:
58-
*
56+
* <pre>Example:
5957
* {@code
6058
* try(Transaction tx = session.beginTransaction() )
6159
* {
62-
* tx.run("CREATE (a:Person {name: {x}})", parameters("x", "Alice"));
60+
* tx.run("CREATE (a:Person {name: $name})", parameters("name", "Alice"));
6361
* tx.commit();
6462
* }
65-
* }
63+
* }</pre>
6664
*/
6765
void commit();
6866

@@ -72,16 +70,14 @@ public interface Transaction extends Resource, QueryRunner
7270
* After this method has been called, the transaction cannot be committed or rolled back again.
7371
* If a transaction is not committed or rolled back before close,
7472
* the transaction will be rolled back by default in {@link #close}.
75-
*
76-
* Example:
77-
*
73+
* <pre>Example:
7874
* {@code
7975
* try(Transaction tx = session.beginTransaction() )
8076
* {
81-
* tx.run("CREATE (a:Person {name: {x}})", parameters("x", "Alice"));
77+
* tx.run("CREATE (a:Person {name: $name})", parameters("name", "Alice"));
8278
* tx.rollback();
8379
* }
84-
* }
80+
* }</pre>
8581
*/
8682
void rollback();
8783

@@ -90,15 +86,13 @@ public interface Transaction extends Resource, QueryRunner
9086
* If the transaction has been {@link #commit() committed} or {@link #rollback() rolled back},
9187
* the close is optional and no operation is performed inside.
9288
* Otherwise, the transaction will be rolled back by default by this method.
93-
*
94-
* Example:
95-
*
89+
* <pre>Example:
9690
* {@code
9791
* try(Transaction tx = session.beginTransaction() )
9892
* {
99-
* tx.run("CREATE (a:Person {name: {x}})", parameters("x", "Alice"));
100-
* }
93+
* tx.run("CREATE (a:Person {name: $name})", parameters("name", "Alice"));
10194
* }
95+
* }</pre>
10296
*/
10397
@Override
10498
void close();

driver/src/main/java/org/neo4j/driver/async/AsyncQueryRunner.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
* <p>
5959
* As noted, most of the time, you will not need to consider this - your writes will
6060
* always be durably stored as long as you either use the results, explicitly commit
61-
* {@link AsyncTransaction transactions} or close the session you used using {@link AsyncSession#closeAsync()}}.
61+
* {@link AsyncTransaction transactions} or close the session you used using {@link AsyncSession#closeAsync()}.
6262
* <p>
6363
* While these semantics introduce some complexity, it gives the driver the ability
6464
* to handle infinite result streams (like subscribing to events), significantly lowers
@@ -78,7 +78,7 @@
7878
*
7979
* @see AsyncSession
8080
* @see AsyncTransaction
81-
* @since 2.0
81+
* @since 4.0
8282
*/
8383
public interface AsyncQueryRunner
8484
{
@@ -102,7 +102,7 @@ public interface AsyncQueryRunner
102102
* {@code
103103
*
104104
* CompletionStage<ResultCursor> cursorStage = session.runAsync(
105-
* "MATCH (n) WHERE n.name = {myNameParam} RETURN (n)",
105+
* "MATCH (n) WHERE n.name = $myNameParam RETURN (n)",
106106
* Values.parameters("myNameParam", "Bob"));
107107
* }
108108
* </pre>
@@ -136,7 +136,7 @@ public interface AsyncQueryRunner
136136
* parameters.put("myNameParam", "Bob");
137137
*
138138
* CompletionStage<ResultCursor> cursorStage = session.runAsync(
139-
* "MATCH (n) WHERE n.name = {myNameParam} RETURN (n)",
139+
* "MATCH (n) WHERE n.name = $myNameParam RETURN (n)",
140140
* parameters);
141141
* }
142142
* </pre>
@@ -191,7 +191,7 @@ public interface AsyncQueryRunner
191191
* <h2>Example</h2>
192192
* <pre>
193193
* {@code
194-
* Query query = new Query( "MATCH (n) WHERE n.name=$myNameParam RETURN n.age" );
194+
* Query query = new Query( "MATCH (n) WHERE n.name = $myNameParam RETURN n.age" );
195195
* CompletionStage<ResultCursor> cursorStage = session.runAsync(query);
196196
* }
197197
* </pre>

driver/src/main/java/org/neo4j/driver/async/AsyncSession.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
/**
3535
* Provides a context of work for database interactions.
3636
* <p>
37-
* A <em>AsyncSession</em> hosts a series of {@linkplain AsyncTransaction transactions}
37+
* An <em>AsyncSession</em> hosts a series of {@linkplain AsyncTransaction transactions}
3838
* carried out against a database. Within the database, all queries are
3939
* carried out within a transaction. Within application code, however, it is
4040
* not always necessary to explicitly {@link #beginTransactionAsync() begin a
@@ -67,7 +67,7 @@
6767
* Similarly, multiple sessions should be used when working with concurrency;
6868
* session implementations are not thread safe.
6969
*
70-
* @since 2.0
70+
* @since 4.0
7171
*/
7272
public interface AsyncSession extends AsyncQueryRunner
7373
{
@@ -221,7 +221,7 @@ public interface AsyncSession extends AsyncQueryRunner
221221
* @return new {@link CompletionStage} that gets completed with a result cursor when query execution is successful.
222222
* Stage can be completed exceptionally when error happens, e.g. connection can't be acquired from the pool.
223223
*/
224-
CompletionStage<ResultCursor> runAsync(String query, TransactionConfig config );
224+
CompletionStage<ResultCursor> runAsync( String query, TransactionConfig config );
225225

226226
/**
227227
* Run a query asynchronously in an auto-commit transaction with the specified {@link TransactionConfig configuration} and return a
@@ -250,7 +250,7 @@ public interface AsyncSession extends AsyncQueryRunner
250250
* parameters.put("myNameParam", "Bob");
251251
*
252252
* CompletionStage<ResultCursor> cursorStage = session.runAsync(
253-
* "MATCH (n) WHERE n.name = {myNameParam} RETURN (n)",
253+
* "MATCH (n) WHERE n.name = $myNameParam RETURN (n)",
254254
* parameters,
255255
* config);
256256
* }
@@ -264,7 +264,7 @@ public interface AsyncSession extends AsyncQueryRunner
264264
* @return new {@link CompletionStage} that gets completed with a result cursor when query execution is successful.
265265
* Stage can be completed exceptionally when error happens, e.g. connection can't be acquired from the pool.
266266
*/
267-
CompletionStage<ResultCursor> runAsync(String query, Map<String,Object> parameters, TransactionConfig config );
267+
CompletionStage<ResultCursor> runAsync( String query, Map<String,Object> parameters, TransactionConfig config );
268268

269269
/**
270270
* Run a query asynchronously in an auto-commit transaction with the specified {@link TransactionConfig configuration} and return a
@@ -280,7 +280,7 @@ public interface AsyncSession extends AsyncQueryRunner
280280
* .withMetadata(metadata)
281281
* .build();
282282
*
283-
* Query query = new Query( "MATCH (n) WHERE n.name=$myNameParam RETURN n.age" );
283+
* Query query = new Query( "MATCH (n) WHERE n.name = $myNameParam RETURN n.age" );
284284
* CompletionStage<ResultCursor> cursorStage = session.runAsync(query, config);
285285
* }
286286
* </pre>
@@ -292,7 +292,7 @@ public interface AsyncSession extends AsyncQueryRunner
292292
* @return new {@link CompletionStage} that gets completed with a result cursor when query execution is successful.
293293
* Stage can be completed exceptionally when error happens, e.g. connection can't be acquired from the pool.
294294
*/
295-
CompletionStage<ResultCursor> runAsync(Query query, TransactionConfig config );
295+
CompletionStage<ResultCursor> runAsync( Query query, TransactionConfig config );
296296

297297
/**
298298
* Return the bookmark received following the last completed

driver/src/main/java/org/neo4j/driver/async/AsyncTransaction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* {@code
4040
* session.beginTransactionAsync()
4141
* .thenCompose(tx ->
42-
* tx.runAsync("CREATE (a:Person {name: {x}})", parameters("x", "Alice"))
42+
* tx.runAsync("CREATE (a:Person {name: $name})", parameters("name", "Alice"))
4343
* .exceptionally(e -> {
4444
* e.printStackTrace();
4545
* return null;
@@ -53,7 +53,7 @@
5353
*
5454
* @see Session#run
5555
* @see QueryRunner
56-
* @since 2.0
56+
* @since 4.0
5757
*/
5858
public interface AsyncTransaction extends AsyncQueryRunner
5959
{

driver/src/main/java/org/neo4j/driver/async/AsyncTransactionWork.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* {@link AsyncSession#writeTransactionAsync(AsyncTransactionWork)} (AsyncTransactionWork)} methods.
2525
*
2626
* @param <T> the return type of this work.
27-
* @since 2.0
27+
* @since 4.0
2828
*/
2929
public interface AsyncTransactionWork<T>
3030
{

driver/src/main/java/org/neo4j/driver/exceptions/FatalDiscoveryException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/**
2222
* This error indicate a fatal problem to obtain routing tables such as the routing table for a specified database does not exist.
2323
* This exception should not be retried.
24-
* @since 2.0
24+
* @since 4.0
2525
*/
2626
public class FatalDiscoveryException extends ClientException
2727
{

driver/src/main/java/org/neo4j/driver/exceptions/value/Unsizable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
package org.neo4j.driver.exceptions.value;
2020

2121
/**
22-
* A <em>Unsizable</em> exception indicates that the value does not have a size.
22+
* An <em>Unsizable</em> exception indicates that the value does not have a size.
2323
* @since 1.0
2424
*/
2525
public class Unsizable extends ValueException

driver/src/main/java/org/neo4j/driver/reactive/RxQueryRunner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* Common interface for components that can execute Neo4j queries using Reactive API.
3030
* @see RxSession
3131
* @see RxTransaction
32-
* @since 2.0
32+
* @since 4.0
3333
*/
3434
public interface RxQueryRunner
3535
{

0 commit comments

Comments
 (0)