@Test public void identity() { EntityReference entityReference = new DocumentReference("wiki", "space", "page"); EntityResourceReference reference1 = new EntityResourceReference(entityReference, EntityResourceAction.VIEW); EntityResourceReference reference2 = new EntityResourceReference(entityReference, EntityResourceAction.VIEW); EntityResourceReference reference3 = new EntityResourceReference(entityReference, new EntityResourceAction("other")); assertEquals(reference1.hashCode(), reference2.hashCode()); assertEquals(reference1, reference2); assertNotEquals(reference1, reference3); }
@Override public int hashCode() { return new HashCodeBuilder(9, 9) .appendSuper(super.hashCode()) .append(getEntityReference()) .append(getLocale()) .append(getAction()) .toHashCode(); }
EntityResourceReference extends AbstractResourceReference { @Override public int hashCode() { return new HashCodeBuilder(9, 9) .appendSuper(super.hashCode()) .append(getEntityReference()) .append(getLocale()) .append(getAction()) .toHashCode(); } }
EntityResourceReference extends AbstractResourceReference { @Override public int hashCode() { return new HashCodeBuilder(9, 9) .appendSuper(super.hashCode()) .append(getEntityReference()) .append(getLocale()) .append(getAction()) .toHashCode(); } EntityResourceReference(EntityReference entityReference, EntityResourceAction action); }
EntityResourceReference extends AbstractResourceReference { @Override public int hashCode() { return new HashCodeBuilder(9, 9) .appendSuper(super.hashCode()) .append(getEntityReference()) .append(getLocale()) .append(getAction()) .toHashCode(); } EntityResourceReference(EntityReference entityReference, EntityResourceAction action); EntityResourceAction getAction(); void setAction(EntityResourceAction action); EntityReference getEntityReference(); void setEntityReference(EntityReference entityReference); void setLocale(Locale locale); Locale getLocale(); void setRevision(String revision); String getRevision(); @Override int hashCode(); @Override boolean equals(Object object); @Override String toString(); }
EntityResourceReference extends AbstractResourceReference { @Override public int hashCode() { return new HashCodeBuilder(9, 9) .appendSuper(super.hashCode()) .append(getEntityReference()) .append(getLocale()) .append(getAction()) .toHashCode(); } EntityResourceReference(EntityReference entityReference, EntityResourceAction action); EntityResourceAction getAction(); void setAction(EntityResourceAction action); EntityReference getEntityReference(); void setEntityReference(EntityReference entityReference); void setLocale(Locale locale); Locale getLocale(); void setRevision(String revision); String getRevision(); @Override int hashCode(); @Override boolean equals(Object object); @Override String toString(); static final ResourceType TYPE; }