mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Replaced all uses of ju.Objects.hashCode and ju.Objects.equals with a copy of their implementations inlined into the code. Also changed source/target for compiler plugin. To test, I compiled my own avaje launchagent against 6, and changed to use that in the pom, compiled/tested the whole project using JDK 7, then ran mvn surefire:test using JDK 6 - running surefire:test ensures that mvn doesn't try to recompile everything against 6, since that's not possible because of some of the delegate classes having delegate methods to JDK 7 jdbc classes.
45 lines
992 B
Java
45 lines
992 B
Java
package com.avaje.ebeaninternal.api;
|
|
|
|
/**
|
|
* A hash for a query plan.
|
|
*/
|
|
public class HashQueryPlan {
|
|
|
|
private final String rawSql;
|
|
|
|
private final int planHash;
|
|
|
|
private final int bindCount;
|
|
|
|
public HashQueryPlan(String rawSql, int planHash, int bindCount) {
|
|
this.rawSql = rawSql;
|
|
this.planHash = planHash;
|
|
this.bindCount = bindCount;
|
|
}
|
|
|
|
public String toString() {
|
|
return planHash+":"+bindCount+(rawSql != null ? ":r" : "");
|
|
}
|
|
|
|
public int hashCode() {
|
|
int hc = planHash;
|
|
hc = hc * 31 + bindCount;
|
|
hc = hc * 31 + (rawSql == null ? 0 : rawSql.hashCode());
|
|
return hc;
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (obj == this) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof HashQueryPlan)) {
|
|
return false;
|
|
}
|
|
|
|
HashQueryPlan e = (HashQueryPlan) obj;
|
|
return e.planHash == planHash
|
|
&& e.bindCount == bindCount
|
|
&& ((e.rawSql == rawSql) || (e.rawSql != null && e.rawSql.equals(rawSql)));
|
|
}
|
|
}
|