Skip to content

Commit

Permalink
#167 added equals and hashCode implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
timowest committed Jun 7, 2012
1 parent ffa6bc0 commit e4065d2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ public Q where(Predicate... o) {
return queryMixin.where(o);
}

public String toString() {
return queryMixin.toString();
}

public Q limit(long limit) {
return queryMixin.limit(limit);
}
Expand All @@ -71,5 +67,27 @@ public Q restrict(QueryModifiers modifiers) {
public <P> Q set(ParamExpression<P> param, P value) {
return queryMixin.set(param, value);
}

@Override
public boolean equals(Object o) {
if (o == this) {
return true;
} else if (o instanceof QueryBase) {
QueryBase q = (QueryBase)o;
return q.queryMixin.equals(queryMixin);
} else {
return false;
}
}

@Override
public int hashCode() {
return queryMixin.hashCode();
}

@Override
public String toString() {
return queryMixin.toString();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,6 @@ public void setUnique(boolean unique) {
metadata.setUnique(unique);
}

@Override
public String toString() {
return metadata.toString();
}

public T where(Predicate... o) {
metadata.addWhere(normalize(o, true));
return self;
Expand All @@ -403,5 +398,28 @@ public T where(Predicate... o) {
protected Predicate[] normalize(Predicate[] conditions, boolean where) {
return conditions;
}

@Override
public boolean equals(Object o) {
if (o == this) {
return true;
} else if (o instanceof QueryMixin) {
QueryMixin q = (QueryMixin)o;
return q.metadata.equals(metadata);
} else {
return false;
}
}

@Override
public int hashCode() {
return metadata.hashCode();
}

@Override
public String toString() {
return metadata.toString();
}


}

0 comments on commit e4065d2

Please sign in to comment.