package org.opentides.bean;
import java.io.Serializable;
/**
* Key value pair used for Ajax functions
* such as autocomplete and dynamic drop-downs.
*
* @author allantan
*
*/
public class JsonKeyValue implements Serializable {
private static final long serialVersionUID = -418294248958300112L;
public JsonKeyValue(Long key, String value) {
super();
this.value = value;
this.key = key;
}
private String value;
private Long key;
/**
* @return the value
*/
public String getValue() {
return value;
}
/**
* @param value the value to set
*/
public void setValue(String value) {
this.value = value;
}
/**
* @return the key
*/
public Long getKey() {
return key;
}
/**
* @param key the key to set
*/
public void setKey(Long key) {
this.key = key;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((key == null) ? 0 : key.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
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 (getClass() != obj.getClass())
return false;
JsonKeyValue other = (JsonKeyValue) obj;
if (key == null) {
if (other.key != null)
return false;
} else if (!key.equals(other.key))
return false;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.value))
return false;
return true;
}
}