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

liquibase.structure.DatabaseObjectComparator Maven / Gradle / Ivy

There is a newer version: 4.30.0
Show newest version
package liquibase.structure;

import liquibase.util.StringUtils;

import java.util.Comparator;

public class DatabaseObjectComparator implements Comparator {

    @Override
    public int compare(DatabaseObject o1, DatabaseObject o2) {
        String name1 = StringUtils.trimToEmpty(o1.getName());
        String name2 = StringUtils.trimToEmpty(o2.getName());

        int i = name1.compareTo(name2);
        if (i == 0) {
            return StringUtils.trimToEmpty(o1.toString()).compareTo(StringUtils.trimToEmpty(o2.toString()));
        }

        return i;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy