@Test public void appendParent() { Map<String, Serializable> map1 = getParamMap(3); Map<String, Serializable> map2 = getParamMap(2); EntityReference wiki = new EntityReference("wiki", EntityType.WIKI, null, map2); EntityReference space = new EntityReference("space", EntityType.SPACE, wiki, map1); EntityReference spaceAlone = new EntityReference("space", EntityType.SPACE, null, map1); EntityReference reference = new EntityReference("page", EntityType.DOCUMENT, space); EntityReference referenceSpace = new EntityReference("page", EntityType.DOCUMENT).appendParent(space); EntityReference referenceWiki = new EntityReference("page", EntityType.DOCUMENT, spaceAlone).appendParent(wiki); assertNotSame(reference, referenceSpace); assertEquals(reference, referenceSpace); assertSame(reference.getParent(), referenceSpace.getParent()); assertNotSame(reference, referenceWiki); assertEquals(reference, referenceWiki); assertSame(reference.getParent().getParent(), referenceSpace.getParent().getParent()); }
public EntityReference appendParent(EntityReference newParent) { if (newParent == null) { return this; } return new EntityReference(this, null, newParent); }
EntityReference implements Serializable, Cloneable, Comparable<EntityReference> { public EntityReference appendParent(EntityReference newParent) { if (newParent == null) { return this; } return new EntityReference(this, null, newParent); } }
EntityReference implements Serializable, Cloneable, Comparable<EntityReference> { public EntityReference appendParent(EntityReference newParent) { if (newParent == null) { return this; } return new EntityReference(this, null, newParent); } EntityReference(EntityReference reference);  EntityReference(EntityReference reference, EntityReference parent); protected  EntityReference(EntityReference reference, EntityReference oldReference, EntityReference newReference);  EntityReference(String name, EntityType type);  EntityReference(String name, EntityType type, EntityReference parent); @Unstable  EntityReference(String name, EntityType type, Map<String, Serializable> parameters);  EntityReference(String name, EntityType type, EntityReference parent, Map<String, Serializable> parameters); @Unstable  EntityReference(EntityReference reference, Map<String, Serializable> parameters); }
EntityReference implements Serializable, Cloneable, Comparable<EntityReference> { public EntityReference appendParent(EntityReference newParent) { if (newParent == null) { return this; } return new EntityReference(this, null, newParent); } EntityReference(EntityReference reference);  EntityReference(EntityReference reference, EntityReference parent); protected  EntityReference(EntityReference reference, EntityReference oldReference, EntityReference newReference);  EntityReference(String name, EntityType type);  EntityReference(String name, EntityType type, EntityReference parent); @Unstable  EntityReference(String name, EntityType type, Map<String, Serializable> parameters);  EntityReference(String name, EntityType type, EntityReference parent, Map<String, Serializable> parameters); @Unstable  EntityReference(EntityReference reference, Map<String, Serializable> parameters); final String getName(); final EntityReference getParent(); final EntityType getType(); final Map<String, Serializable> getParameters(); @Transient EntityReference getRoot(); @Transient List<EntityReference> getReversedReferenceChain(); int size(); EntityReference extractReference(EntityType type); EntityReference extractFirstReference(EntityType type); EntityReference replaceParent(EntityReference oldParent, EntityReference newParent); EntityReference replaceParent(EntityReference newParent); EntityReference appendParent(EntityReference newParent); EntityReference removeParent(EntityReference oldParent); boolean hasParent(EntityReference expectedParent); @Override String toString(); @Override boolean equals(Object obj); boolean equals(EntityReference otherReference, EntityType to); boolean equals(EntityReference otherReference, EntityType from, EntityType to); boolean equalsNonRecursive(EntityReference otherReference); @Override int hashCode(); @Override int compareTo(EntityReference reference); }
EntityReference implements Serializable, Cloneable, Comparable<EntityReference> { public EntityReference appendParent(EntityReference newParent) { if (newParent == null) { return this; } return new EntityReference(this, null, newParent); } EntityReference(EntityReference reference);  EntityReference(EntityReference reference, EntityReference parent); protected  EntityReference(EntityReference reference, EntityReference oldReference, EntityReference newReference);  EntityReference(String name, EntityType type);  EntityReference(String name, EntityType type, EntityReference parent); @Unstable  EntityReference(String name, EntityType type, Map<String, Serializable> parameters);  EntityReference(String name, EntityType type, EntityReference parent, Map<String, Serializable> parameters); @Unstable  EntityReference(EntityReference reference, Map<String, Serializable> parameters); final String getName(); final EntityReference getParent(); final EntityType getType(); final Map<String, Serializable> getParameters(); @Transient EntityReference getRoot(); @Transient List<EntityReference> getReversedReferenceChain(); int size(); EntityReference extractReference(EntityType type); EntityReference extractFirstReference(EntityType type); EntityReference replaceParent(EntityReference oldParent, EntityReference newParent); EntityReference replaceParent(EntityReference newParent); EntityReference appendParent(EntityReference newParent); EntityReference removeParent(EntityReference oldParent); boolean hasParent(EntityReference expectedParent); @Override String toString(); @Override boolean equals(Object obj); boolean equals(EntityReference otherReference, EntityType to); boolean equals(EntityReference otherReference, EntityType from, EntityType to); boolean equalsNonRecursive(EntityReference otherReference); @Override int hashCode(); @Override int compareTo(EntityReference reference);  }