Skip to content

Commit c474e1a

Browse files
tomekl007olim7t
authored andcommitted
JAVA-2542: Improve the javadocs of methods in CqlSession (scylladb#34)
1 parent 83e931b commit c474e1a

File tree

5 files changed

+60
-0
lines changed

5 files changed

+60
-0
lines changed

changelog/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This version brings in all functionality that was formerly only in the DataStax
88
such as the built-in support for reactive programming. Going forward, all new features will be
99
implemented in this single driver.
1010

11+
- [documentation] JAVA-2542: JAVA-2542: Improve the javadocs of methods in CqlSession
1112
- [documentation] JAVA-2609: Add docs for proxy authentication to unified driver
1213
- [improvement] JAVA-2554: Improve efficiency of InsightsClient by improving supportsInsights check
1314
- [improvement] JAVA-2601: Inject Google Tag Manager scripts in generated API documentation

core/src/main/java/com/datastax/dse/driver/api/core/graph/GraphSession.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ public interface GraphSession extends Session {
5353
* Apache Cassandra® cluster will result in a runtime error.
5454
*
5555
* @see GraphResultSet
56+
* @param graphStatement the graph query to execute (that can be any {@code GraphStatement}).
57+
* @return the result of the graph query. That result will never be null but can be empty.
5658
*/
5759
@NonNull
5860
default GraphResultSet execute(@NonNull GraphStatement<?> graphStatement) {
@@ -70,6 +72,8 @@ default GraphResultSet execute(@NonNull GraphStatement<?> graphStatement) {
7072
*
7173
* @see #execute(GraphStatement)
7274
* @see AsyncGraphResultSet
75+
* @param graphStatement the graph query to execute (that can be any {@code GraphStatement}).
76+
* @return the {@code CompletionStage} on the result of the graph query.
7377
*/
7478
@NonNull
7579
default CompletionStage<AsyncGraphResultSet> executeAsync(

core/src/main/java/com/datastax/oss/driver/api/core/CqlSession.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ public interface CqlSession
5656
* Returns a builder to create a new instance.
5757
*
5858
* <p>Note that this builder is mutable and not thread-safe.
59+
*
60+
* @return {@code CqlSessionBuilder} to create a new instance.
5961
*/
6062
@NonNull
6163
static CqlSessionBuilder builder() {

core/src/main/java/com/datastax/oss/driver/api/core/cql/AsyncCqlSession.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public interface AsyncCqlSession extends Session {
3131
/**
3232
* Executes a CQL statement asynchronously (the call returns as soon as the statement was sent,
3333
* generally before the result is available).
34+
*
35+
* @param statement the CQL query to execute (that can be any {@code Statement}).
36+
* @return a {@code CompletionStage} that, once complete, will produce the async result set.
3437
*/
3538
@NonNull
3639
default CompletionStage<AsyncResultSet> executeAsync(@NonNull Statement<?> statement) {
@@ -41,6 +44,9 @@ default CompletionStage<AsyncResultSet> executeAsync(@NonNull Statement<?> state
4144
/**
4245
* Executes a CQL statement asynchronously (the call returns as soon as the statement was sent,
4346
* generally before the result is available).
47+
*
48+
* @param query the CQL query to execute.
49+
* @return a {@code CompletionStage} that, once complete, will produce the async result set.
4450
*/
4551
@NonNull
4652
default CompletionStage<AsyncResultSet> executeAsync(@NonNull String query) {
@@ -57,6 +63,9 @@ default CompletionStage<AsyncResultSet> executeAsync(@NonNull String query) {
5763
*
5864
* <p>The result of this method is cached (see {@link SyncCqlSession#prepare(SimpleStatement)} for
5965
* more explanations).
66+
*
67+
* @param statement the CQL query to prepare (that can be any {@code SimpleStatement}).
68+
* @return a {@code CompletionStage} that, once complete, will produce the prepared statement.
6069
*/
6170
@NonNull
6271
default CompletionStage<PreparedStatement> prepareAsync(@NonNull SimpleStatement statement) {
@@ -71,6 +80,9 @@ default CompletionStage<PreparedStatement> prepareAsync(@NonNull SimpleStatement
7180
*
7281
* <p>The result of this method is cached (see {@link SyncCqlSession#prepare(SimpleStatement)} for
7382
* more explanations).
83+
*
84+
* @param query the CQL query string to prepare.
85+
* @return a {@code CompletionStage} that, once complete, will produce the prepared statement.
7486
*/
7587
@NonNull
7688
default CompletionStage<PreparedStatement> prepareAsync(@NonNull String query) {
@@ -90,6 +102,9 @@ default CompletionStage<PreparedStatement> prepareAsync(@NonNull String query) {
90102
*
91103
* <p>The result of this method is cached (see {@link SyncCqlSession#prepare(SimpleStatement)} for
92104
* more explanations).
105+
*
106+
* @param request the {@code PrepareRequest} to prepare.
107+
* @return a {@code CompletionStage} that, once complete, will produce the prepared statement.
93108
*/
94109
@NonNull
95110
default CompletionStage<PreparedStatement> prepareAsync(PrepareRequest request) {

core/src/main/java/com/datastax/oss/driver/api/core/cql/SyncCqlSession.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
*/
1616
package com.datastax.oss.driver.api.core.cql;
1717

18+
import com.datastax.oss.driver.api.core.AllNodesFailedException;
19+
import com.datastax.oss.driver.api.core.servererrors.QueryExecutionException;
20+
import com.datastax.oss.driver.api.core.servererrors.QueryValidationException;
21+
import com.datastax.oss.driver.api.core.servererrors.SyntaxError;
1822
import com.datastax.oss.driver.api.core.session.Request;
1923
import com.datastax.oss.driver.api.core.session.Session;
2024
import com.datastax.oss.driver.internal.core.cql.DefaultPrepareRequest;
@@ -31,6 +35,17 @@ public interface SyncCqlSession extends Session {
3135
/**
3236
* Executes a CQL statement synchronously (the calling thread blocks until the result becomes
3337
* available).
38+
*
39+
* @param statement the CQL query to execute (that can be any {@link Statement}).
40+
* @return the result of the query. That result will never be null but can be empty (and will be
41+
* for any non SELECT query).
42+
* @throws AllNodesFailedException if no host in the cluster can be contacted successfully to
43+
* execute this query.
44+
* @throws QueryExecutionException if the query triggered an execution exception, i.e. an
45+
* exception thrown by Cassandra when it cannot execute the query with the requested
46+
* consistency level successfully.
47+
* @throws QueryValidationException if the query is invalid (syntax error, unauthorized or any
48+
* other validation problem).
3449
*/
3550
@NonNull
3651
default ResultSet execute(@NonNull Statement<?> statement) {
@@ -41,6 +56,17 @@ default ResultSet execute(@NonNull Statement<?> statement) {
4156
/**
4257
* Executes a CQL statement synchronously (the calling thread blocks until the result becomes
4358
* available).
59+
*
60+
* @param query the CQL query to execute.
61+
* @return the result of the query. That result will never be null but can be empty (and will be
62+
* for any non SELECT query).
63+
* @throws AllNodesFailedException if no host in the cluster can be contacted successfully to
64+
* execute this query.
65+
* @throws QueryExecutionException if the query triggered an execution exception, i.e. an
66+
* exception thrown by Cassandra when it cannot execute the query with the requested
67+
* consistency level successfully.
68+
* @throws QueryValidationException if the query if invalid (syntax error, unauthorized or any
69+
* other validation problem).
4470
*/
4571
@NonNull
4672
default ResultSet execute(@NonNull String query) {
@@ -110,6 +136,10 @@ default ResultSet execute(@NonNull String query) {
110136
* query strings but different {@linkplain SimpleStatement#getConsistencyLevel() consistency
111137
* levels} will yield distinct prepared statements.
112138
* </ul>
139+
*
140+
* @param statement the CQL query to execute (that can be any {@link SimpleStatement}).
141+
* @return the prepared statement corresponding to {@code statement}.
142+
* @throws SyntaxError if the syntax of the query to prepare is not correct.
113143
*/
114144
@NonNull
115145
default PreparedStatement prepare(@NonNull SimpleStatement statement) {
@@ -124,6 +154,10 @@ default PreparedStatement prepare(@NonNull SimpleStatement statement) {
124154
*
125155
* <p>The result of this method is cached (see {@link #prepare(SimpleStatement)} for more
126156
* explanations).
157+
*
158+
* @param query the CQL string query to execute.
159+
* @return the prepared statement corresponding to {@code query}.
160+
* @throws SyntaxError if the syntax of the query to prepare is not correct.
127161
*/
128162
@NonNull
129163
default PreparedStatement prepare(@NonNull String query) {
@@ -143,6 +177,10 @@ default PreparedStatement prepare(@NonNull String query) {
143177
*
144178
* <p>The result of this method is cached (see {@link #prepare(SimpleStatement)} for more
145179
* explanations).
180+
*
181+
* @param request the {@code PrepareRequest} to execute.
182+
* @return the prepared statement corresponding to {@code request}.
183+
* @throws SyntaxError if the syntax of the query to prepare is not correct.
146184
*/
147185
@NonNull
148186
default PreparedStatement prepare(@NonNull PrepareRequest request) {

0 commit comments

Comments
 (0)