+ * This class encapsulates all configuration properties required by Doma, + * such as {@link DataSource}, {@link Dialect}, and {@link JdbcLogger}. + *
+ * The configuration is built using a builder pattern through {@link DomaConfigBuilder}.
*
* @author Toshiaki Maki
+ * @see DomaConfigBuilder
*/
public class DomaConfig implements Config {
diff --git a/doma-spring-boot-autoconfigure/src/main/java/org/seasar/doma/boot/autoconfigure/DomaConfigBuilder.java b/doma-spring-boot-autoconfigure/src/main/java/org/seasar/doma/boot/autoconfigure/DomaConfigBuilder.java
index ced71c3e..74179cd6 100644
--- a/doma-spring-boot-autoconfigure/src/main/java/org/seasar/doma/boot/autoconfigure/DomaConfigBuilder.java
+++ b/doma-spring-boot-autoconfigure/src/main/java/org/seasar/doma/boot/autoconfigure/DomaConfigBuilder.java
@@ -62,8 +62,10 @@ public DataSource dataSource() {
*
* @param dataSource dataSource to use
* @return chained builder
+ * @throws NullPointerException if dataSource is null
*/
public DomaConfigBuilder dataSource(DataSource dataSource) {
+ Objects.requireNonNull(dataSource, "dataSource must not be null");
this.dataSource = new TransactionAwareDataSourceProxy(dataSource);
return this;
}
@@ -72,7 +74,15 @@ public Dialect dialect() {
return dialect;
}
+ /**
+ * Set the Dialect.
+ *
+ * @param dialect the Dialect
+ * @return this instance
+ * @throws NullPointerException if dialect is null
+ */
public DomaConfigBuilder dialect(Dialect dialect) {
+ Objects.requireNonNull(dialect, "dialect must not be null");
this.dialect = dialect;
return this;
}
@@ -81,7 +91,15 @@ public JdbcLogger jdbcLogger() {
return jdbcLogger;
}
+ /**
+ * Set the JdbcLogger.
+ *
+ * @param jdbcLogger the JdbcLogger
+ * @return this instance
+ * @throws NullPointerException if jdbcLogger is null
+ */
public DomaConfigBuilder jdbcLogger(JdbcLogger jdbcLogger) {
+ Objects.requireNonNull(jdbcLogger, "jdbcLogger must not be null");
this.jdbcLogger = jdbcLogger;
return this;
}
@@ -90,7 +108,15 @@ public SqlFileRepository sqlFileRepository() {
return sqlFileRepository;
}
+ /**
+ * Set the SqlFileRepository.
+ *
+ * @param sqlFileRepository the SqlFileRepository
+ * @return this instance
+ * @throws NullPointerException if sqlFileRepository is null
+ */
public DomaConfigBuilder sqlFileRepository(SqlFileRepository sqlFileRepository) {
+ Objects.requireNonNull(sqlFileRepository, "sqlFileRepository must not be null");
this.sqlFileRepository = sqlFileRepository;
return this;
}
@@ -146,7 +172,15 @@ public Naming naming() {
return naming;
}
+ /**
+ * Set the Naming convention.
+ *
+ * @param naming the Naming convention
+ * @return this instance
+ * @throws NullPointerException if naming is null
+ */
public DomaConfigBuilder naming(Naming naming) {
+ Objects.requireNonNull(naming, "naming must not be null");
this.naming = naming;
return this;
}
@@ -173,8 +207,16 @@ public EntityListenerProvider entityListenerProvider() {
return entityListenerProvider;
}
+ /**
+ * Set the EntityListenerProvider.
+ *
+ * @param entityListenerProvider the EntityListenerProvider
+ * @return this instance
+ * @throws NullPointerException if entityListenerProvider is null
+ */
public DomaConfigBuilder entityListenerProvider(
EntityListenerProvider entityListenerProvider) {
+ Objects.requireNonNull(entityListenerProvider, "entityListenerProvider must not be null");
this.entityListenerProvider = entityListenerProvider;
return this;
}
diff --git a/doma-spring-boot-autoconfigure/src/test/java/org/seasar/doma/boot/autoconfigure/DomaAutoConfigurationTest.java b/doma-spring-boot-autoconfigure/src/test/java/org/seasar/doma/boot/autoconfigure/DomaAutoConfigurationTest.java
index c638e1b3..cbe7871b 100644
--- a/doma-spring-boot-autoconfigure/src/test/java/org/seasar/doma/boot/autoconfigure/DomaAutoConfigurationTest.java
+++ b/doma-spring-boot-autoconfigure/src/test/java/org/seasar/doma/boot/autoconfigure/DomaAutoConfigurationTest.java
@@ -318,7 +318,7 @@ public void testDialectMissingJdbConnectionDetails() {
BeanCreationException exception = assertThrows(BeanCreationException.class,
() -> this.context.refresh());
assertThat(exception.getMessage(), containsString(
- "No connection details available. You will probably have to set 'doma.dialect' explicitly."));
+ "No JdbcConnectionDetails available. You will need to explicitly set 'doma.dialect' property in your configuration."));
}
@Test
diff --git a/doma-spring-boot-core/src/main/java/org/seasar/doma/boot/DomaSpringBootSqlBuilderSettings.java b/doma-spring-boot-core/src/main/java/org/seasar/doma/boot/DomaSpringBootSqlBuilderSettings.java
index 6453e130..e411e98c 100644
--- a/doma-spring-boot-core/src/main/java/org/seasar/doma/boot/DomaSpringBootSqlBuilderSettings.java
+++ b/doma-spring-boot-core/src/main/java/org/seasar/doma/boot/DomaSpringBootSqlBuilderSettings.java
@@ -4,21 +4,16 @@
import org.seasar.doma.jdbc.SqlBuilderSettings;
-public class DomaSpringBootSqlBuilderSettings implements SqlBuilderSettings {
-
- private final Predicate
+ * This record encapsulates the SQL builder settings used by Doma in a Spring Boot application.
+ */
+public record DomaSpringBootSqlBuilderSettings(
+ Predicate