All Downloads are FREE. Search and download functionalities are using the official Maven repository.

liquibase.snapshot.SnapshotGeneratorComparator Maven / Gradle / Ivy

The newest version!
package liquibase.snapshot;

import liquibase.database.Database;
import liquibase.structure.DatabaseObject;

import java.util.Comparator;

class SnapshotGeneratorComparator implements Comparator {

    private final Class objectType;
    private final Database database;

    public SnapshotGeneratorComparator(Class objectType, Database database) {
        this.objectType = objectType;
        this.database = database;
    }

    @Override
    public int compare(SnapshotGenerator o1, SnapshotGenerator o2) {
        int result = -1 * Integer.compare(o1.getPriority(objectType, database), o2.getPriority(objectType, database));
        if (result == 0) {
            return o1.getClass().getName().compareTo(o2.getClass().getName());
        }
        return result;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy