
com.alibaba.druid.sql.ast.SQLExprComparor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of druid Show documentation
Show all versions of druid Show documentation
An JDBC datasource implementation.
package com.alibaba.druid.sql.ast;
import java.util.Comparator;
public class SQLExprComparor implements Comparator {
public static final SQLExprComparor instance = new SQLExprComparor();
@Override
public int compare(SQLExpr a, SQLExpr b) {
return compareTo(a, b);
}
public static int compareTo(SQLExpr a, SQLExpr b) {
if (a == null && b == null) {
return 0;
}
if (a == null) {
return -1;
}
if (b == null) {
return 1;
}
if (a.getClass() == b.getClass() && a instanceof Comparable) {
return ((Comparable) a).compareTo(b);
}
return a.getClass().getName().compareTo(b.getClass().getName());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy