[jOOQ/jOOQ#9506] All migration objects are Scopes
This commit is contained in:
parent
9e04de7cf8
commit
ddf9afc09b
@ -52,7 +52,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @author Lukas Eder
|
||||
*/
|
||||
@Experimental
|
||||
public interface History extends Iterable<Version> {
|
||||
public interface History extends Iterable<Version>, Scope {
|
||||
|
||||
/**
|
||||
* The root {@link Version}.
|
||||
|
||||
@ -48,7 +48,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @author Lukas Eder
|
||||
*/
|
||||
@Experimental
|
||||
public interface Migrations {
|
||||
public interface Migrations extends Scope {
|
||||
|
||||
/**
|
||||
* Initialise a {@link File}
|
||||
|
||||
@ -52,7 +52,7 @@ import org.jetbrains.annotations.ApiStatus.Experimental;
|
||||
* @author Lukas Eder
|
||||
*/
|
||||
@Experimental
|
||||
public interface Node<N extends Node<N>> {
|
||||
public interface Node<N extends Node<N>> extends Scope {
|
||||
|
||||
/**
|
||||
* The ID of the node, unique within the graph.
|
||||
|
||||
@ -43,20 +43,23 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.jooq.Configuration;
|
||||
import org.jooq.Node;
|
||||
import org.jooq.exception.DataDefinitionException;
|
||||
|
||||
/**
|
||||
* @author Lukas Eder
|
||||
*/
|
||||
abstract class AbstractNode<N extends Node<N>> implements Node<N> {
|
||||
abstract class AbstractNode<N extends Node<N>> extends AbstractScope implements Node<N> {
|
||||
|
||||
final N root;
|
||||
final String id;
|
||||
final String message;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
AbstractNode(String id, String message, N root) {
|
||||
AbstractNode(Configuration configuration, String id, String message, N root) {
|
||||
super(configuration);
|
||||
|
||||
this.root = root != null ? root : (N) this;
|
||||
this.id = id;
|
||||
this.message = defaultIfNull(message, "");
|
||||
|
||||
@ -75,7 +75,6 @@ import org.jooq.tools.StringUtils;
|
||||
*/
|
||||
final class CommitImpl extends AbstractNode<Commit> implements Commit {
|
||||
|
||||
final Configuration configuration;
|
||||
final DSLContext ctx;
|
||||
final List<Commit> parents;
|
||||
final List<Tag> tags;
|
||||
@ -83,9 +82,8 @@ final class CommitImpl extends AbstractNode<Commit> implements Commit {
|
||||
final Map<String, File> files;
|
||||
|
||||
CommitImpl(Configuration configuration, String id, String message, Commit root, List<Commit> parents, Collection<? extends File> delta) {
|
||||
super(id, message, root);
|
||||
super(configuration, id, message, root);
|
||||
|
||||
this.configuration = configuration;
|
||||
this.ctx = configuration.dsl();
|
||||
this.parents = parents;
|
||||
this.tags = new ArrayList<>();
|
||||
@ -94,9 +92,8 @@ final class CommitImpl extends AbstractNode<Commit> implements Commit {
|
||||
}
|
||||
|
||||
private CommitImpl(CommitImpl copy) {
|
||||
super(copy.id(), copy.message(), copy.root);
|
||||
super(copy.configuration(), copy.id(), copy.message(), copy.root);
|
||||
|
||||
this.configuration = copy.configuration;
|
||||
this.ctx = copy.ctx;
|
||||
this.parents = copy.parents;
|
||||
this.tags = new ArrayList<>(copy.tags);
|
||||
@ -192,7 +189,7 @@ final class CommitImpl extends AbstractNode<Commit> implements Commit {
|
||||
|
||||
@Override
|
||||
public final Commit commit(String newId, String newMessage, Collection<? extends File> newFiles) {
|
||||
return new CommitImpl(configuration, newId, newMessage, root, Arrays.asList(this), newFiles);
|
||||
return new CommitImpl(configuration(), newId, newMessage, root, Arrays.asList(this), newFiles);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -212,7 +209,7 @@ final class CommitImpl extends AbstractNode<Commit> implements Commit {
|
||||
|
||||
@Override
|
||||
public final Commit merge(String newId, String newMessage, Commit with, Collection<? extends File> newFiles) {
|
||||
return new CommitImpl(configuration, newId, newMessage, root, Arrays.asList(this, with), newFiles);
|
||||
return new CommitImpl(configuration(), newId, newMessage, root, Arrays.asList(this, with), newFiles);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -72,7 +72,7 @@ final class VersionImpl extends AbstractNode<Version> implements Version {
|
||||
final List<Parent> parents;
|
||||
|
||||
private VersionImpl(Configuration configuration, String id, Meta meta, Version root, List<Parent> parents) {
|
||||
super(id, null, root);
|
||||
super(configuration, id, null, root);
|
||||
|
||||
this.ctx = configuration.dsl();
|
||||
this.meta = meta != null ? meta : init(ctx);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user