Skip to content

Commit

Permalink
fix: Fix PageKey equals and hashCode methods - Meeds-io/MIPs#120
Browse files Browse the repository at this point in the history
  • Loading branch information
boubaker committed Apr 24, 2024
1 parent c4fba07 commit bfbe2bc
Showing 1 changed file with 20 additions and 2 deletions.
@@ -1,6 +1,7 @@
package org.exoplatform.portal.mop.page;

import java.io.Serializable;
import java.util.Objects;

import org.apache.commons.lang3.StringUtils;

Expand Down Expand Up @@ -62,8 +63,8 @@ public PageKey sibling(String name) {
public String format() {
if (ref == null) {
ref = String.format("%s::%s::%s",
site.getType().getName(),
site.getName(),
site == null ? "" : site.getType().getName(),
site == null ? "" : site.getName(),
name);
}
return ref;
Expand All @@ -79,4 +80,21 @@ public org.exoplatform.portal.pom.data.PageKey toPomPageKey() {
public String toString() {
return format();
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PageKey other = (PageKey) obj;
return Objects.equals(format(), other.format());
}

@Override
public int hashCode() {
return Objects.hash(format());
}
}

0 comments on commit bfbe2bc

Please sign in to comment.