mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Split DatabaseBuilder interface separating the setters n getters adding DatabaseBuilder.Settings
So DatabaseBuilder.Settings has all the getters for code looking to read the configuration that has been set. So DatabaseBuilder now just has the setter methods. Use DatabaseBuilder.settings() to access the settings and read the config that has been set.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -75,9 +75,10 @@ public final class DatabaseFactory {
|
||||
*
|
||||
* }</pre>
|
||||
*/
|
||||
public static Database create(DatabaseBuilder config) {
|
||||
public static Database create(DatabaseBuilder builder) {
|
||||
lock.lock();
|
||||
try {
|
||||
var config = builder.settings();
|
||||
if (config.getName() == null) {
|
||||
throw new PersistenceException("The name is null (it is required)");
|
||||
}
|
||||
@@ -131,7 +132,7 @@ public final class DatabaseFactory {
|
||||
}
|
||||
}
|
||||
|
||||
private static Database createInternal(DatabaseBuilder config) {
|
||||
private static Database createInternal(DatabaseBuilder.Settings config) {
|
||||
return container(config.getContainerConfig()).createServer(config);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ import java.util.function.Function;
|
||||
* @author rbygrave
|
||||
* @see DatabaseFactory
|
||||
*/
|
||||
public class DatabaseConfig implements DatabaseBuilder {
|
||||
public class DatabaseConfig implements DatabaseBuilder.Settings {
|
||||
|
||||
/**
|
||||
* The Database name.
|
||||
@@ -548,6 +548,11 @@ public class DatabaseConfig implements DatabaseBuilder {
|
||||
public DatabaseConfig() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Settings settings() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Clock getClock() {
|
||||
return clock;
|
||||
|
||||
@@ -16,7 +16,7 @@ public interface SpiServer extends Database {
|
||||
/**
|
||||
* Return the DatabaseConfig.
|
||||
*/
|
||||
DatabaseBuilder config();
|
||||
DatabaseBuilder.Settings config();
|
||||
|
||||
/**
|
||||
* Return the DatabasePlatform for this database.
|
||||
|
||||
Reference in New Issue
Block a user