com.jpattern.orm.session.SqlSelectQuery Maven / Gradle / Ivy
package com.jpattern.orm.session;
import java.util.Arrays;
/**
*
* @author Francesco Cina'
*
* Dec 20, 2011
*/
public class SqlSelectQuery {
private final String sql;
private final int maxRows;
private final int timeout;
private final Object[] args;
public SqlSelectQuery(String sql, Object[] args, int maxRows, int timeout) {
this.sql = sql;
this.args = args;
this.maxRows = maxRows;
this.timeout = timeout;
}
public String getSql() {
return sql;
}
public int getMaxRows() {
return maxRows;
}
public int getTimeout() {
return timeout;
}
public Object[] getArgs() {
return args;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + Arrays.hashCode(args);
result = prime * result + maxRows;
result = prime * result + ((sql == null) ? 0 : sql.hashCode());
result = prime * result + timeout;
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof SqlSelectQuery)) {
return false;
}
SqlSelectQuery other = (SqlSelectQuery) obj;
if (!Arrays.equals(args, other.args)) {
return false;
}
if (maxRows != other.maxRows) {
return false;
}
if (sql == null) {
if (other.sql != null) {
return false;
}
} else if (!sql.equals(other.sql)) {
return false;
}
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy