[jOOQ/jOOQ#11078] Override CatalogImpl.equals()

This commit is contained in:
Lukas Eder 2020-12-02 17:02:35 +01:00
parent 9d3dc2e7d5
commit 02ebcc4312

View File

@ -39,6 +39,8 @@ package org.jooq.impl;
import static org.jooq.Clause.CATALOG;
import static org.jooq.Clause.CATALOG_REFERENCE;
import static org.jooq.impl.CatalogImpl.DEFAULT_CATALOG;
import static org.jooq.tools.StringUtils.defaultIfNull;
import java.util.Collections;
import java.util.List;
@ -50,6 +52,7 @@ import org.jooq.Comment;
import org.jooq.Context;
import org.jooq.Name;
import org.jooq.Schema;
import org.jooq.tools.StringUtils;
/**
* A common base class for database catalogs
@ -125,4 +128,21 @@ public class CatalogImpl extends AbstractNamed implements Catalog {
return getSchemas().stream();
}
// ------------------------------------------------------------------------
// XXX: Object API
// ------------------------------------------------------------------------
@Override
public boolean equals(Object that) {
if (this == that)
return true;
// [#11078] CatalogImpl equality can be decided without executing the
// rather expensive implementation of AbstractQueryPart.equals()
if (that instanceof CatalogImpl)
return StringUtils.equals(getName(), ((CatalogImpl) that).getName());
return super.equals(that);
}
}