37
37
import org .springframework .util .Assert ;
38
38
39
39
/**
40
- * A non-blocking, reactive client for performing database calls requests with
40
+ * A non-blocking, reactive client for performing database calls with
41
41
* Reactive Streams back pressure. Provides a higher level, common API over
42
42
* R2DBC client libraries.
43
43
*
44
- * <p>Use one of the static factory methods {@link #create(ConnectionFactory)}
45
- * or obtain a {@link DatabaseClient#builder()} to create an instance.
44
+ * <p>Use the static factory method {@link #create(ConnectionFactory)} or obtain
45
+ * a {@linkplain DatabaseClient#builder() builder } to create an instance.
46
46
*
47
- * Usage example:
47
+ * <p> Usage example:
48
48
* <pre class="code">
49
49
* ConnectionFactory factory = …
50
50
*
51
51
* DatabaseClient client = DatabaseClient.create(factory);
52
52
* Mono<Actor> actor = client.sql("select first_name, last_name from t_actor")
53
53
* .map(row -> new Actor(row.get("first_name", String.class),
54
54
* row.get("last_name", String.class)))
55
- * .first();
56
- * </pre>
55
+ * .first();</pre>
57
56
*
58
57
* @author Mark Paluch
59
58
* @since 5.3
60
59
*/
61
60
public interface DatabaseClient extends ConnectionAccessor {
62
61
63
62
/**
64
- * Return the {@link ConnectionFactory} that this client uses.
63
+ * Get the {@link ConnectionFactory} that this client uses.
65
64
* @return the connection factory
66
65
*/
67
66
ConnectionFactory getConnectionFactory ();
68
67
69
68
/**
70
- * Specify a static {@code sql} statement to run. Contract for specifying a
69
+ * Specify a static {@code sql} statement to run. Contract for specifying an
71
70
* SQL call along with options leading to the execution. The SQL string can
72
71
* contain either native parameter bind markers or named parameters (e.g.
73
72
* {@literal :foo, :bar}) when {@link NamedParameterExpander} is enabled.
@@ -79,7 +78,7 @@ public interface DatabaseClient extends ConnectionAccessor {
79
78
GenericExecuteSpec sql (String sql );
80
79
81
80
/**
82
- * Specify a {@link Supplier SQL supplier} that provides SQL to run.
81
+ * Specify an {@linkplain Supplier SQL supplier} that provides SQL to run.
83
82
* Contract for specifying an SQL call along with options leading to
84
83
* the execution. The SQL string can contain either native parameter
85
84
* bind markers or named parameters (e.g. {@literal :foo, :bar}) when
@@ -99,7 +98,7 @@ public interface DatabaseClient extends ConnectionAccessor {
99
98
/**
100
99
* Create a {@code DatabaseClient} that will use the provided {@link ConnectionFactory}.
101
100
* @param factory the {@code ConnectionFactory} to use for obtaining connections
102
- * @return a new {@code DatabaseClient}. Guaranteed to be not {@code null}.
101
+ * @return a new {@code DatabaseClient}; never {@code null}
103
102
*/
104
103
static DatabaseClient create (ConnectionFactory factory ) {
105
104
return new DefaultDatabaseClientBuilder ().connectionFactory (factory ).build ();
@@ -129,22 +128,22 @@ interface Builder {
129
128
Builder connectionFactory (ConnectionFactory factory );
130
129
131
130
/**
132
- * Configure a {@link ExecuteFunction} to execute {@link Statement} objects.
131
+ * Configure an {@link ExecuteFunction} to execute {@link Statement} objects.
133
132
* @see Statement#execute()
134
133
*/
135
134
Builder executeFunction (ExecuteFunction executeFunction );
136
135
137
136
/**
138
137
* Configure whether to use named parameter expansion.
139
- * Defaults to {@code true}.
138
+ * <p> Defaults to {@code true}.
140
139
* @param enabled {@code true} to use named parameter expansion;
141
140
* {@code false} to disable named parameter expansion
142
141
* @see NamedParameterExpander
143
142
*/
144
143
Builder namedParameters (boolean enabled );
145
144
146
145
/**
147
- * Configures a {@link Consumer} to configure this builder.
146
+ * Apply a {@link Consumer} to configure this builder.
148
147
*/
149
148
Builder apply (Consumer <Builder > builderConsumer );
150
149
@@ -238,7 +237,7 @@ default GenericExecuteSpec filter(Function<? super Statement, ? extends Statemen
238
237
* Perform the SQL call and apply {@link BiFunction function} to the {@link Result}.
239
238
* @param mappingFunction a function that maps from {@link Result} into a result publisher
240
239
* @param <R> the result type
241
- * @return a {@link Flux} emitting mapped elements
240
+ * @return a {@link Flux} that emits mapped elements
242
241
* @since 6.0
243
242
* @see Result#filter(Predicate)
244
243
* @see Result#flatMap(Function)
0 commit comments