Package liquibase.snapshot
Interface SnapshotGenerator
- All Known Implementing Classes:
CatalogSnapshotGenerator,ColumnSnapshotGenerator,ColumnSnapshotGeneratorH2,ColumnSnapshotGeneratorInformix,ColumnSnapshotGeneratorOracle,DataSnapshotGenerator,ForeignKeySnapshotGenerator,IndexSnapshotGenerator,JdbcSnapshotGenerator,PrimaryKeySnapshotGenerator,SchemaSnapshotGenerator,SchemaSnapshotGeneratorSnowflake,SequenceSnapshotGenerator,SequenceSnapshotGeneratorSnowflake,TableSnapshotGenerator,UniqueConstraintSnapshotGenerator,UniqueConstraintSnapshotGeneratorSnowflake,ViewSnapshotGenerator
public interface SnapshotGenerator
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionClass<? extends DatabaseObject>[]addsTo()When snapshotting a certain object type (e.g. a table), different types of objects might be discovered in the process.intgetPriority(Class<? extends DatabaseObject> objectType, Database database) Inquire if this SnapshotGenerator is capable of snapshotting objects of type objectType (e.g.Class<? extends SnapshotGenerator>[]replaces()Returns classes (and superclasses) that this SnapshotGenerator replaces.<T extends DatabaseObject>
Tsnapshot(T example, DatabaseSnapshot snapshot, SnapshotGeneratorChain chain) Commands the SnapshotGenerator to create a snapshot (a representation of a database object in Java object form) of a specific database object.
-
Field Details
-
PRIORITY_NONE
static final int PRIORITY_NONE- See Also:
-
PRIORITY_DEFAULT
static final int PRIORITY_DEFAULT- See Also:
-
PRIORITY_DATABASE
static final int PRIORITY_DATABASE- See Also:
-
PRIORITY_ADDITIONAL
static final int PRIORITY_ADDITIONAL- See Also:
-
-
Method Details
-
getPriority
Inquire if this SnapshotGenerator is capable of snapshotting objects of type objectType (e.g. Table, Index, View etc.) in the DBMS database (e.g. Oracle, Postgres, HyperSQL etc.) A return priority of > 0 will be interpreted as capable. The highest priority for an objectType-database combination wins.- Parameters:
objectType- The object type we are asked to snapshotdatabase- The DBMS for which the snapshotting should be done- Returns:
- An integer of PRIORITY_... constants indicating our capability and willingness to snapshot
-
snapshot
<T extends DatabaseObject> T snapshot(T example, DatabaseSnapshot snapshot, SnapshotGeneratorChain chain) throws DatabaseException, InvalidExampleException Commands the SnapshotGenerator to create a snapshot (a representation of a database object in Java object form) of a specific database object.- Type Parameters:
T- The Java object type in which we are to return the snapshot result- Parameters:
example- The object we should try to snapshotsnapshot- The Snapshot object representing the result of the snapshot operations so farchain- A list of other SnapshotGenerators that might be asked to try the same- Returns:
- An object of type T if our snapshot attempt is successful
- Throws:
DatabaseException- If an operation on the database failsInvalidExampleException- If, for some reason, we cannot work on the example object (ambiguous naming etc.)
-
addsTo
Class<? extends DatabaseObject>[] addsTo()When snapshotting a certain object type (e.g. a table), different types of objects might be discovered in the process. (TODO: Which ones? Needs a more precise description.)- Returns:
- an array of classes that this SnapshotGenerator might return upon snapshotting a given DatabaseObject type.
-
replaces
Class<? extends SnapshotGenerator>[] replaces()Returns classes (and superclasses) that this SnapshotGenerator replaces. Return null or empty array to not affect the SnapshotGeneratorChain.
-