@Test public void getReversedReferenceChain() { EntityReference wiki = new EntityReference("wiki", EntityType.WIKI); EntityReference space = new EntityReference("space", EntityType.SPACE, wiki); EntityReference reference = new EntityReference("page", EntityType.DOCUMENT, space); List<EntityReference> list = reference.getReversedReferenceChain(); assertEquals(3, list.size()); assertSame(wiki, list.get(0)); assertSame(space, list.get(1)); assertSame(reference, list.get(2)); }
@Transient public List<EntityReference> getReversedReferenceChain() { if (this.referenceList == null) { LinkedList<EntityReference> referenceDeque = new LinkedList<EntityReference>(); EntityReference reference = this; do { referenceDeque.push(reference); reference = reference.getParent(); } while (reference != null); this.referenceList = Collections.<EntityReference>unmodifiableList(referenceDeque); } return this.referenceList; }
EntityReference implements Serializable, Cloneable, Comparable<EntityReference> { @Transient public List<EntityReference> getReversedReferenceChain() { if (this.referenceList == null) { LinkedList<EntityReference> referenceDeque = new LinkedList<EntityReference>(); EntityReference reference = this; do { referenceDeque.push(reference); reference = reference.getParent(); } while (reference != null); this.referenceList = Collections.<EntityReference>unmodifiableList(referenceDeque); } return this.referenceList; } }
EntityReference implements Serializable, Cloneable, Comparable<EntityReference> { @Transient public List<EntityReference> getReversedReferenceChain() { if (this.referenceList == null) { LinkedList<EntityReference> referenceDeque = new LinkedList<EntityReference>(); EntityReference reference = this; do { referenceDeque.push(reference); reference = reference.getParent(); } while (reference != null); this.referenceList = Collections.<EntityReference>unmodifiableList(referenceDeque); } return this.referenceList; } 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> { @Transient public List<EntityReference> getReversedReferenceChain() { if (this.referenceList == null) { LinkedList<EntityReference> referenceDeque = new LinkedList<EntityReference>(); EntityReference reference = this; do { referenceDeque.push(reference); reference = reference.getParent(); } while (reference != null); this.referenceList = Collections.<EntityReference>unmodifiableList(referenceDeque); } return this.referenceList; } 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> { @Transient public List<EntityReference> getReversedReferenceChain() { if (this.referenceList == null) { LinkedList<EntityReference> referenceDeque = new LinkedList<EntityReference>(); EntityReference reference = this; do { referenceDeque.push(reference); reference = reference.getParent(); } while (reference != null); this.referenceList = Collections.<EntityReference>unmodifiableList(referenceDeque); } return this.referenceList; } 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);  }