Skip to content

Commit ae35979

Browse files
authored
Add javadoc comments for the Criteria API. (#507)
Primary parts only.
1 parent ba5ec9e commit ae35979

39 files changed

+640
-0
lines changed

doma-core/src/main/java/org/seasar/doma/jdbc/criteria/Entityql.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
import org.seasar.doma.jdbc.criteria.statement.EntityqlUpdateStatement;
2323
import org.seasar.doma.jdbc.criteria.statement.Statement;
2424

25+
/**
26+
* Provides the ways to query and associate entities. Use {@link NativeSql} to issue more complex
27+
* SQL statements than this class does.
28+
*/
2529
public class Entityql {
2630

2731
protected final Config config;

doma-core/src/main/java/org/seasar/doma/jdbc/criteria/NativeSql.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
import org.seasar.doma.jdbc.criteria.statement.NativeSqlUpdateStarting;
2626
import org.seasar.doma.jdbc.query.SelectQuery;
2727

28+
/**
29+
* Provides the ways to issue more complex SQL statements rather than {@link Entityql} does. But
30+
* note that this class doesn't support to associate entities.
31+
*/
2832
public class NativeSql {
2933

3034
protected final Config config;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/** Provides classes that execute SQL statements and handle the results. */
2+
package org.seasar.doma.jdbc.criteria.command;

doma-core/src/main/java/org/seasar/doma/jdbc/criteria/context/DeleteSettings.java

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,95 @@
11
package org.seasar.doma.jdbc.criteria.context;
22

3+
import java.sql.PreparedStatement;
4+
5+
/** Represents the settings for a DELETE criteria query. */
36
public class DeleteSettings extends Settings {
47
private int batchSize = 0;
58
private boolean allowEmptyWhere;
69
private boolean ignoreVersion;
710
private boolean suppressOptimisticLockException;
811

12+
/**
13+
* Returns the batch size.
14+
*
15+
* @return the batch size. The default value is {@literal 0}.
16+
*/
917
public int getBatchSize() {
1018
return batchSize;
1119
}
1220

21+
/**
22+
* Sets the batch size.
23+
*
24+
* <p>If the value is less than 1, it is regarded as 1.
25+
*
26+
* @param batchSize the batch size
27+
* @see PreparedStatement#executeBatch()
28+
* @see PreparedStatement#addBatch()
29+
*/
1330
public void setBatchSize(int batchSize) {
1431
this.batchSize = batchSize;
1532
}
1633

34+
/**
35+
* Returns whether the empty WHERE clause is allowed or not.
36+
*
37+
* @return whether the empty WHERE clause is allowed or not. The default value is {@literal
38+
* false}.
39+
*/
1740
public boolean getAllowEmptyWhere() {
1841
return allowEmptyWhere;
1942
}
2043

44+
/**
45+
* Sets whether the empty WHERE clause is allowed or not.
46+
*
47+
* <p>If the value is {@literal true} and the WHERE clause is empty, {@link
48+
* org.seasar.doma.jdbc.criteria.statement.EmptyWhereClauseException} will be suppressed.
49+
*
50+
* @param allowEmptyWhere whether the empty WHERE clause is allowed or not
51+
*/
2152
public void setAllowEmptyWhere(boolean allowEmptyWhere) {
2253
this.allowEmptyWhere = allowEmptyWhere;
2354
}
2455

56+
/**
57+
* Returns whether to ignore the version property or not.
58+
*
59+
* @return whether to ignore the version property or not. The default value is {@literal false}.
60+
*/
2561
public boolean getIgnoreVersion() {
2662
return ignoreVersion;
2763
}
2864

65+
/**
66+
* Sets whether to ignore the version property or not.
67+
*
68+
* <p>If the value is {@code true}, the column that mapped to the version property is excluded
69+
* from the SQL DELETE statement.
70+
*
71+
* @param ignoreVersion whether to ignore the version property or not
72+
*/
2973
public void setIgnoreVersion(boolean ignoreVersion) {
3074
this.ignoreVersion = ignoreVersion;
3175
}
3276

77+
/**
78+
* Returns whether to suppress {@link org.seasar.doma.jdbc.OptimisticLockException} or not.
79+
*
80+
* @return whether to suppress {@link org.seasar.doma.jdbc.OptimisticLockException} or not. The
81+
* default value is {@literal false}.
82+
*/
3383
public boolean getSuppressOptimisticLockException() {
3484
return suppressOptimisticLockException;
3585
}
3686

87+
/**
88+
* Sets whether to suppress {@link org.seasar.doma.jdbc.OptimisticLockException} or not.
89+
*
90+
* @param suppressOptimisticLockException whether to suppress {@link
91+
* org.seasar.doma.jdbc.OptimisticLockException} or not
92+
*/
3793
public void setSuppressOptimisticLockException(boolean suppressOptimisticLockException) {
3894
this.suppressOptimisticLockException = suppressOptimisticLockException;
3995
}

doma-core/src/main/java/org/seasar/doma/jdbc/criteria/context/InsertSettings.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,51 @@
11
package org.seasar.doma.jdbc.criteria.context;
22

3+
import java.sql.PreparedStatement;
4+
5+
/** Represents the settings for an INSERT criteria query. */
36
public class InsertSettings extends Settings {
47
private int batchSize = 0;
58
private boolean excludeNull;
69

10+
/**
11+
* Returns the batch size.
12+
*
13+
* @return the batch size. The default value is {@literal 0}.
14+
*/
715
public int getBatchSize() {
816
return batchSize;
917
}
1018

19+
/**
20+
* Sets the batch size.
21+
*
22+
* <p>If the value is less than 1, it is regarded as 1.
23+
*
24+
* @param batchSize the batch size
25+
* @see PreparedStatement#executeBatch()
26+
* @see PreparedStatement#addBatch()
27+
*/
1128
public void setBatchSize(int batchSize) {
1229
this.batchSize = batchSize;
1330
}
1431

32+
/**
33+
* Returns whether to exclude null properties or not.
34+
*
35+
* @return whether to exclude null properties or not. The default value is {@literal false}.
36+
*/
1537
public boolean getExcludeNull() {
1638
return excludeNull;
1739
}
1840

41+
/**
42+
* Sets whether to exclude null properties or not.
43+
*
44+
* <p>If the value is {@code true}, the null properties are excluded from the SQL INSERT
45+
* statement.
46+
*
47+
* @param excludeNull whether to exclude null properties or not
48+
*/
1949
public void setExcludeNull(boolean excludeNull) {
2050
this.excludeNull = excludeNull;
2151
}

doma-core/src/main/java/org/seasar/doma/jdbc/criteria/context/SelectSettings.java

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,74 @@
11
package org.seasar.doma.jdbc.criteria.context;
22

3+
import java.sql.Statement;
4+
5+
/** Represents the settings for a SELECT criteria query. */
36
public class SelectSettings extends Settings {
47
private boolean allowEmptyWhere = true;
58
private int fetchSize = 0;
69
private int maxRows = 0;
710

11+
/**
12+
* Returns whether the empty WHERE clause is allowed or not.
13+
*
14+
* @return whether the empty WHERE clause is allowed or not. The default value is {@literal true}.
15+
*/
816
public boolean getAllowEmptyWhere() {
917
return allowEmptyWhere;
1018
}
1119

20+
/**
21+
* Sets whether the empty WHERE clause is allowed or not.
22+
*
23+
* <p>If the value is {@literal false} and the WHERE clause is empty, {@link
24+
* org.seasar.doma.jdbc.criteria.statement.EmptyWhereClauseException} will be thrown.
25+
*
26+
* @param allowEmptyWhere whether the empty WHERE clause is allowed or not
27+
*/
1228
public void setAllowEmptyWhere(boolean allowEmptyWhere) {
1329
this.allowEmptyWhere = allowEmptyWhere;
1430
}
1531

32+
/**
33+
* Returns the fetch size.
34+
*
35+
* @return the fetch size. The default value is {@literal 0}.
36+
*/
1637
public int getFetchSize() {
1738
return fetchSize;
1839
}
1940

41+
/**
42+
* Sets the fetch size.
43+
*
44+
* <p>If the value is greater than or equal to 1, it is passed to {@link
45+
* Statement#setFetchSize(int)}.
46+
*
47+
* @param fetchSize the fetch size
48+
* @see Statement#setFetchSize(int)
49+
*/
2050
public void setFetchSize(int fetchSize) {
2151
this.fetchSize = fetchSize;
2252
}
2353

54+
/**
55+
* Returns the maximum number of rows for a {@code ResultSet} object.
56+
*
57+
* @return the maximum number of rows. The default value is {@literal 0}
58+
*/
2459
public int getMaxRows() {
2560
return maxRows;
2661
}
2762

63+
/**
64+
* Sets the maximum number of rows for a {@code ResultSet} object.
65+
*
66+
* <p>If the value is greater than or equal to 1, it is passed to {@link
67+
* Statement#setMaxRows(int)}.
68+
*
69+
* @param maxRows the maximum number of rows
70+
* @see Statement#setMaxRows(int)
71+
*/
2872
public void setMaxRows(int maxRows) {
2973
this.maxRows = maxRows;
3074
}

doma-core/src/main/java/org/seasar/doma/jdbc/criteria/context/Settings.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,73 @@
11
package org.seasar.doma.jdbc.criteria.context;
22

3+
import java.sql.Statement;
34
import java.util.Objects;
45
import org.seasar.doma.jdbc.SqlLogType;
56

7+
/** Represents the settings for a criteria query. */
68
public class Settings {
79
private String comment;
810
private SqlLogType sqlLogType = SqlLogType.FORMATTED;
911
private int queryTimeout = 0;
1012

13+
/**
14+
* Returns the comment for the SQL statement.
15+
*
16+
* @return the comment. The default value is {@literal null}.
17+
*/
1118
public String getComment() {
1219
return comment;
1320
}
1421

22+
/**
23+
* Sets the comment for the SQL statement.
24+
*
25+
* <p>The implementation of {@link org.seasar.doma.jdbc.Commenter} can use this value.
26+
*
27+
* @param comment the comment for the SQL statement
28+
*/
1529
public void setComment(String comment) {
1630
Objects.requireNonNull(comment);
1731
this.comment = comment;
1832
}
1933

34+
/**
35+
* Returns the SQL log type.
36+
*
37+
* @return the SQL log type. The default value is {@link SqlLogType#FORMATTED }
38+
*/
2039
public SqlLogType getSqlLogType() {
2140
return sqlLogType;
2241
}
2342

43+
/**
44+
* Sets the SQL log type.
45+
*
46+
* <p>Specify {@link SqlLogType#RAW } or {@link SqlLogType#NONE } for the sensitive SQL statement.
47+
*
48+
* @param sqlLogType the SQL log type
49+
*/
2450
public void setSqlLogType(SqlLogType sqlLogType) {
2551
Objects.requireNonNull(sqlLogType);
2652
this.sqlLogType = sqlLogType;
2753
}
2854

55+
/**
56+
* Returns the query timeout limit in seconds.
57+
*
58+
* @return the query timeout limit in seconds. The default value is {@literal 0}.
59+
*/
2960
public int getQueryTimeout() {
3061
return queryTimeout;
3162
}
3263

64+
/**
65+
* Sets the query timeout limit in seconds.
66+
*
67+
* @param queryTimeout the query timeout limit in seconds. If the value is greater than or equal
68+
* to 1, it is passed to {@link Statement#setQueryTimeout(int)}.
69+
* @see Statement#setQueryTimeout(int)
70+
*/
3371
public void setQueryTimeout(int queryTimeout) {
3472
this.queryTimeout = queryTimeout;
3573
}

0 commit comments

Comments
 (0)