Java tutorial
/* * Copyright (C) 2003, 2004 Joe Walnes. * Copyright (C) 2006, 2007, 2011 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD * style license a copy of which has been included with this distribution in * the LICENSE.txt file. * * Created on 25. October 2003 by Joe Walnes */ package com.thoughtworks.acceptance.objects; import org.apache.commons.lang.builder.CompareToBuilder; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; import java.io.Serializable; public class StandardObject implements Serializable, Comparable { public boolean equals(Object obj) { return EqualsBuilder.reflectionEquals(this, obj); } public int hashCode() { return HashCodeBuilder.reflectionHashCode(this); } public String toString() { return ToStringBuilder.reflectionToString(this); } public int compareTo(Object obj) { return CompareToBuilder.reflectionCompare(this, obj); } }