mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1147 - Refactor move DbMigration internals into io.ebeaninternal - change to use DbMigration.create() - move DbMigrationFactory.create() method
This commit is contained in:
@@ -6,6 +6,8 @@ import io.ebean.config.ServerConfig;
|
||||
import io.ebean.config.dbplatform.DatabasePlatform;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
/**
|
||||
* Generates DDL migration scripts based on changes to the current model.
|
||||
@@ -39,7 +41,12 @@ public interface DbMigration {
|
||||
* Create a DbMigration implementation to use.
|
||||
*/
|
||||
static DbMigration create() {
|
||||
return DbMigrationFactory.create();
|
||||
|
||||
Iterator<DbMigration> loader = ServiceLoader.load(DbMigration.class).iterator();
|
||||
if (loader.hasNext()) {
|
||||
return loader.next();
|
||||
}
|
||||
throw new IllegalStateException("No service implementation found for DbMigration?");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package io.ebean.dbmigration;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
class DbMigrationFactory {
|
||||
|
||||
static DbMigration create() {
|
||||
|
||||
Iterator<DbMigration> loader = ServiceLoader.load(DbMigration.class).iterator();
|
||||
if (loader.hasNext()) {
|
||||
return loader.next();
|
||||
}
|
||||
throw new IllegalStateException("No service implementation found for DbMigration?");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user