Skip to content

Commit 0fb92ef

Browse files
committed
Improving UpsertAssemblerContext validation and add comment
1 parent 78fbd92 commit 0fb92ef

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

doma-core/src/main/java/org/seasar/doma/jdbc/query/UpsertAssemblerContext.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.seasar.doma.jdbc.query;
22

33
import java.util.List;
4+
import java.util.Objects;
45
import org.seasar.doma.DomaIllegalArgumentException;
56
import org.seasar.doma.internal.jdbc.sql.PreparedSqlBuilder;
67
import org.seasar.doma.jdbc.InParameter;
@@ -36,6 +37,20 @@ public class UpsertAssemblerContext {
3637
/** set clause property-value pair list */
3738
public final List<Tuple2<EntityPropertyType<?, ?>, UpsertSetValue>> setValues;
3839

40+
/**
41+
* Constructs an instance of UpsertAssemblerContext with the specified prepared SQL builder,
42+
* entity
43+
*
44+
* @param buf the prepared SQL builder
45+
* @param entityType the entity type
46+
* @param duplicateKeyType the duplicate key type
47+
* @param naming the naming
48+
* @param dialect the dialect
49+
* @param keys the conflicting keys
50+
* @param insertValues the values clause property-parameter pair list
51+
* @param setValues the set clause property-value pair list(optional).Required in case of
52+
* duplicateKeyType.UPDATE
53+
*/
3954
public UpsertAssemblerContext(
4055
PreparedSqlBuilder buf,
4156
EntityType<?> entityType,
@@ -45,6 +60,13 @@ public UpsertAssemblerContext(
4560
List<EntityPropertyType<?, ?>> keys,
4661
List<Tuple2<EntityPropertyType<?, ?>, InParameter<?>>> insertValues,
4762
List<Tuple2<EntityPropertyType<?, ?>, UpsertSetValue>> setValues) {
63+
Objects.requireNonNull(buf);
64+
Objects.requireNonNull(entityType);
65+
Objects.requireNonNull(duplicateKeyType);
66+
Objects.requireNonNull(naming);
67+
Objects.requireNonNull(dialect);
68+
Objects.requireNonNull(keys);
69+
Objects.requireNonNull(insertValues);
4870
if (duplicateKeyType == DuplicateKeyType.EXCEPTION) {
4971
throw new DomaIllegalArgumentException(
5072
"duplicateKeyType",

0 commit comments

Comments
 (0)