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

liquibase.diff.compare.DatabaseObjectComparatorComparator Maven / Gradle / Ivy

There is a newer version: 3.6.2.5.inovus
Show newest version
package liquibase.diff.compare;

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

import java.util.Comparator;

class DatabaseObjectComparatorComparator implements Comparator {

    private Class objectType;
    private Database database;

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy