Skip to content

Commit

Permalink
Added toString, hashCode and equals to UICategoryImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Jan 31, 2013
1 parent 56126fc commit db08e18
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion ui/api/src/main/java/org/jboss/forge/ui/util/Categories.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

/**
* Utility for creating hierarchical {@link UICategory} instances.
*
*
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
*/
public class Categories
Expand Down Expand Up @@ -64,5 +64,48 @@ public UICategory getSubCategory()
{
return subCategory;
}

@Override
public String toString()
{
return getName() + "/" + (getSubCategory() != null ? getSubCategory() : "");
}

@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((subCategory == null) ? 0 : subCategory.hashCode());
return result;
}

@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
UICategoryImpl other = (UICategoryImpl) obj;
if (name == null)
{
if (other.name != null)
return false;
}
else if (!name.equals(other.name))
return false;
if (subCategory == null)
{
if (other.subCategory != null)
return false;
}
else if (!subCategory.equals(other.subCategory))
return false;
return true;
}
}
}

0 comments on commit db08e18

Please sign in to comment.