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

com.avaje.ebeaninternal.api.HashQuery Maven / Gradle / Ivy

There is a newer version: 8.1.1
Show newest version
package com.avaje.ebeaninternal.api;

/**
 * A hash key for a query including both the query plan and bind values.
 */
public class HashQuery {

  private final CQueryPlanKey planHash;
  
  private final int bindHash;

  /**
   * Create the HashQuery.
   */
  public HashQuery(CQueryPlanKey planHash, int bindHash) {
    this.planHash = planHash;
    this.bindHash = bindHash;
  }

  public String toString() {
    return "HashQuery@" + Integer.toHexString(hashCode());
  }

  public int hashCode() {
    int hc = 31 * planHash.hashCode();
    hc = 31 * hc + bindHash;
    return hc;
  }
  
  public boolean equals(Object obj) {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof HashQuery)) {
      return false;
    }
    
    HashQuery e = (HashQuery) obj;
    return e.bindHash == bindHash && e.planHash.equals(planHash);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy