mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-07-07 17:12:29 +02:00
implement equals, hashCode and toString of ChangesetPagingResult
This commit is contained in:
@@ -33,6 +33,10 @@
|
||||
|
||||
package sonia.scm.repository;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -47,7 +51,7 @@ import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* The changeset paging result is used to do a paging over the
|
||||
* The changeset paging result is used to do a paging over the
|
||||
* {@link Changeset}s of a {@link Repository}.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -83,6 +87,45 @@ public class ChangesetPagingResult implements Iterable<Changeset>, Serializable
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param obj
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final ChangesetPagingResult other = (ChangesetPagingResult) obj;
|
||||
|
||||
return Objects.equal(changesets, other.changesets)
|
||||
&& Objects.equal(total, other.total);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return Objects.hashCode(changesets, total);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator which can iterate over the current list of changesets.
|
||||
*
|
||||
@@ -103,6 +146,23 @@ public class ChangesetPagingResult implements Iterable<Changeset>, Serializable
|
||||
return it;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
//J-
|
||||
return Objects.toStringHelper(this)
|
||||
.add("changesets", changesets)
|
||||
.add("total", total)
|
||||
.toString();
|
||||
//J+
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
||||
@@ -77,11 +77,14 @@ public final class LogCommandRequest implements Serializable, Resetable
|
||||
|
||||
final LogCommandRequest other = (LogCommandRequest) obj;
|
||||
|
||||
//J-
|
||||
return Objects.equal(startChangeset, other.startChangeset)
|
||||
&& Objects.equal(endChangeset, other.endChangeset)
|
||||
&& Objects.equal(pagingStart, other.pagingStart)
|
||||
&& Objects.equal(pagingLimit, other.pagingLimit)
|
||||
&& Objects.equal(path, other.path) && Objects.equal(branch, other.branch);
|
||||
&& Objects.equal(path, other.path)
|
||||
&& Objects.equal(branch, other.branch);
|
||||
//J+
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user