@Test public void testEquals() { ResourceReference reference1 = new ResourceReference("reference", ResourceType.DOCUMENT); ResourceReference reference2 = new ResourceReference("reference", ResourceType.DOCUMENT); assertEquals(reference1, reference2); reference2.addBaseReference("base"); assertFalse(reference1.equals(reference2)); assertFalse(reference1.equals(null)); assertFalse(reference1.equals("different object class")); reference1.addBaseReference("base"); assertEquals(reference1, reference2); assertEquals(reference1, reference1); }
@Override public boolean equals(Object object) { if (!(object instanceof ResourceReference)) { return false; } if (object == this) { return true; } ResourceReference rhs = (ResourceReference) object; return new EqualsBuilder() .append(getType(), rhs.getType()) .append(isTyped(), rhs.isTyped()) .append(getReference(), rhs.getReference()) .append(getBaseReferences(), rhs.getBaseReferences()) .append(getParameters(), rhs.getParameters()) .isEquals(); }
ResourceReference implements Cloneable { @Override public boolean equals(Object object) { if (!(object instanceof ResourceReference)) { return false; } if (object == this) { return true; } ResourceReference rhs = (ResourceReference) object; return new EqualsBuilder() .append(getType(), rhs.getType()) .append(isTyped(), rhs.isTyped()) .append(getReference(), rhs.getReference()) .append(getBaseReferences(), rhs.getBaseReferences()) .append(getParameters(), rhs.getParameters()) .isEquals(); } }
ResourceReference implements Cloneable { @Override public boolean equals(Object object) { if (!(object instanceof ResourceReference)) { return false; } if (object == this) { return true; } ResourceReference rhs = (ResourceReference) object; return new EqualsBuilder() .append(getType(), rhs.getType()) .append(isTyped(), rhs.isTyped()) .append(getReference(), rhs.getReference()) .append(getBaseReferences(), rhs.getBaseReferences()) .append(getParameters(), rhs.getParameters()) .isEquals(); } ResourceReference(String reference, ResourceType type); }
ResourceReference implements Cloneable { @Override public boolean equals(Object object) { if (!(object instanceof ResourceReference)) { return false; } if (object == this) { return true; } ResourceReference rhs = (ResourceReference) object; return new EqualsBuilder() .append(getType(), rhs.getType()) .append(isTyped(), rhs.isTyped()) .append(getReference(), rhs.getReference()) .append(getBaseReferences(), rhs.getBaseReferences()) .append(getParameters(), rhs.getParameters()) .isEquals(); } ResourceReference(String reference, ResourceType type); void setTyped(boolean typed); boolean isTyped(); void setReference(String reference); String getReference(); void addBaseReference(String baseReference); void addBaseReferences(List<String> baseReferences); List<String> getBaseReferences(); ResourceType getType(); void setType(ResourceType type); void setParameter(String name, String value); void setParameters(Map<String, String> parameters); void removeParameter(String name); String getParameter(String name); Map<String, String> getParameters(); @Override String toString(); @Override ResourceReference clone(); @Override int hashCode(); @Override boolean equals(Object object); }
ResourceReference implements Cloneable { @Override public boolean equals(Object object) { if (!(object instanceof ResourceReference)) { return false; } if (object == this) { return true; } ResourceReference rhs = (ResourceReference) object; return new EqualsBuilder() .append(getType(), rhs.getType()) .append(isTyped(), rhs.isTyped()) .append(getReference(), rhs.getReference()) .append(getBaseReferences(), rhs.getBaseReferences()) .append(getParameters(), rhs.getParameters()) .isEquals(); } ResourceReference(String reference, ResourceType type); void setTyped(boolean typed); boolean isTyped(); void setReference(String reference); String getReference(); void addBaseReference(String baseReference); void addBaseReferences(List<String> baseReferences); List<String> getBaseReferences(); ResourceType getType(); void setType(ResourceType type); void setParameter(String name, String value); void setParameters(Map<String, String> parameters); void removeParameter(String name); String getParameter(String name); Map<String, String> getParameters(); @Override String toString(); @Override ResourceReference clone(); @Override int hashCode(); @Override boolean equals(Object object);  }