/*- * Copyright © 2009 Diamond Light Source Ltd. * * This file is part of GDA. * * GDA is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 as published by the Free * Software Foundation. * * GDA is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with GDA. If not, see <http://www.gnu.org/licenses/>. */ package uk.ac.gda.richbeans.examples; import java.io.Serializable; import org.apache.commons.beanutils.BeanUtils; /** * */ public class ExampleItem implements Serializable{ private Double x,y; @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((x == null) ? 0 : x.hashCode()); result = prime * result + ((y == null) ? 0 : y.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } ExampleItem other = (ExampleItem) obj; if (x == null) { if (other.x != null) { return false; } } else if (!x.equals(other.x)) { return false; } if (y == null) { if (other.y != null) { return false; } } else if (!y.equals(other.y)) { return false; } return true; } /** * @return the x */ public Double getX() { return x; } /** * @param x the x to set */ public void setX(Double x) { this.x = x; } /** * @return the y */ public Double getY() { return y; } /** * @param y the y to set */ public void setY(Double y) { this.y = y; } @Override public String toString() { try { return BeanUtils.describe(this).toString(); } catch (Exception e) { return e.getMessage(); } } }