implement hasCode, toString and equals method of browserresult

This commit is contained in:
Sebastian Sdorra
2012-02-26 20:41:40 +01:00
parent a017b3da11
commit 4be3d930fa

View File

@@ -33,6 +33,10 @@
package sonia.scm.repository;
//~--- non-JDK imports --------------------------------------------------------
import com.google.common.base.Objects;
//~--- JDK imports ------------------------------------------------------------
import java.util.Iterator;
@@ -80,6 +84,47 @@ public class BrowserResult implements Iterable<FileObject>
//~--- methods --------------------------------------------------------------
/**
* {@inheritDoc}
*
*
* @param obj
*
* @return
*/
@Override
public boolean equals(Object obj)
{
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
final BrowserResult other = (BrowserResult) obj;
return Objects.equal(revision, other.revision)
&& Objects.equal(tag, other.tag)
&& Objects.equal(branch, other.branch)
&& Objects.equal(files, other.files);
}
/**
* {@inheritDoc}
*
*
* @return
*/
@Override
public int hashCode()
{
return Objects.hashCode(revision, tag, branch, files);
}
/**
* Method description
*
@@ -99,6 +144,25 @@ public class BrowserResult implements Iterable<FileObject>
return it;
}
/**
* {@inheritDoc}
*
*
* @return
*/
@Override
public String toString()
{
//J-
return Objects.toStringHelper(this)
.add("revision", revision)
.add("tag", tag)
.add("branch", branch)
.add("files", files)
.toString();
//J+
}
//~--- get methods ----------------------------------------------------------
/**