org.openfact.models.search.OrderByModel Maven / Gradle / Ivy
package org.openfact.models.search;
/**
* Models order-by for a search.
*/
public class OrderByModel {
private String name;
private boolean ascending;
/**
* Constructor.
*/
public OrderByModel() {
}
/**
* @return the ascending
*/
public boolean isAscending() {
return ascending;
}
/**
* @param ascending the ascending to set
*/
public void setAscending(boolean ascending) {
this.ascending = ascending;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (ascending ? 1231 : 1237);
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
/**
* @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 (getClass() != obj.getClass())
return false;
OrderByModel other = (OrderByModel) obj;
if (ascending != other.ascending)
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
}