Class SnapshotGeneratorChain
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends DatabaseObject>
Tsnapshot
(T example, DatabaseSnapshot snapshot) This calls all the non-replacedSnapshotGenerator
in the chain, by comparison order.
-
Constructor Details
-
SnapshotGeneratorChain
-
-
Method Details
-
snapshot
public <T extends DatabaseObject> T snapshot(T example, DatabaseSnapshot snapshot) throws DatabaseException, InvalidExampleException This calls all the non-replacedSnapshotGenerator
in the chain, by comparison order.During the chain processing, the snapshot method returns an object that will be passed to the next generator in the chain. The object can be the same object that was passed to the generator, or a new object, given that: - the generator copies the attributes of the provided object to a new object and returns the new object (liquibase-hibernate extension does this in https://github.com/liquibase/liquibase-hibernate/blob/main/src/main/java/liquibase/ext/hibernate/snapshot/IndexSnapshotGenerator.java#L31 ) - the generator returns the existing instance (they can e.g. set new attributes to it)
Snapshot generators that do not abide by the previous rules must be the first to be called for a given object type and there are not more than one of these per object type. Note that this can get tricky as extensions can bring their own snapshot generators to the mix breaking core generators.
- Returns:
- snapshot object
- Throws:
DatabaseException
InvalidExampleException
- See Also:
-