Galera, tenho o seguinte objeto. Gostaria de diferenciar um objeto de outro através do atributo codFila. Para isso sobrescrevi os métodos equals e hashCode. Porém não está dando certo!!!
[code]
public class StatusAgentesFilasAtualVO
{
private String codFila;
private int nroAgente;
private int qtdChamAtendidas;
private int horUltimaChamada;
private String idtStatus;
private int statusPausa;
public String getCodFila()
{
return codFila;
}
public void setCodFila(String codFila)
{
this.codFila = codFila;
}
[b]....... Outros getters e setters[/b]
// Verifica se os objetos sao equivalentes
public boolean equals(Object o)
{
if((o instanceof StatusAgentesFilasAtualVO)&&(((StatusAgentesFilasAtualVO)o).getCodFila()==this.codFila))
{
return true;
}
else
{
return false;
}
}
public int hashCode ()
{
int hash = 0;
if (codFila != null)
hash = codFila.hashCode();
if (nroAgente != 0)
hash = hash * 37 + Integer.valueOf(nroAgente).hashCode();
if (qtdChamAtendidas != 0)
hash = hash * 37 + Integer.valueOf(qtdChamAtendidas).hashCode();
if (horUltimaChamada != 0)
hash = hash * 37 + Integer.valueOf(horUltimaChamada).hashCode();
if (idtStatus != null)
hash = hash * 37 + idtStatus.hashCode();
if (statusPausa != 0)
hash = hash * 37 + Integer.valueOf(statusPausa).hashCode();
return hash;
}
}[/code]