/* * Hibernate, Relational Persistence for Idiomatic Java * * Copyright (c) 2011, Red Hat Middleware LLC or third-party contributors as * indicated by the @author tags or express copyright attribution * statements applied by the authors. All third-party contributions are * distributed under license by Red Hat Middleware LLC. * * This copyrighted material is made available to anyone wishing to use, modify, * copy, or redistribute it subject to the terms and conditions of the GNU * Lesser General Public License, as published by the Free Software Foundation. * * This program 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 Lesser General Public License * for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this distribution; if not, write to: * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA * */ package org.hibernate.test.criteria; /** * @author David Mansfield */ public class StudentAddress { private String line1; private String line2; private String city; private String state; private String zip; public String getLine1() { return line1; } public void setLine1(String line1) { this.line1 = line1; } public String getLine2() { return line2; } public void setLine2(String line2) { this.line2 = line2; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getZip() { return zip; } public void setZip(String zip) { this.zip = zip; } // @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((city == null) ? 0 : city.hashCode()); result = prime * result + ((line1 == null) ? 0 : line1.hashCode()); result = prime * result + ((line2 == null) ? 0 : line2.hashCode()); result = prime * result + ((state == null) ? 0 : state.hashCode()); result = prime * result + ((zip == null) ? 0 : zip.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; StudentAddress other = (StudentAddress) obj; if (city == null) { if (other.city != null) return false; } else if (!city.equals(other.city)) return false; if (line1 == null) { if (other.line1 != null) return false; } else if (!line1.equals(other.line1)) return false; if (line2 == null) { if (other.line2 != null) return false; } else if (!line2.equals(other.line2)) return false; if (state == null) { if (other.state != null) return false; } else if (!state.equals(other.state)) return false; if (zip == null) { if (other.zip != null) return false; } else if (!zip.equals(other.zip)) return false; return true; } }