@Test public void testSpaceReferences() { DocumentReference reference1 = new DocumentReference("wiki", "space", "page"); List<SpaceReference> spaceRefs = reference1.getSpaceReferences(); assertEquals(1, spaceRefs.size()); assertEquals(new SpaceReference("space", new WikiReference("wiki")), spaceRefs.get(0)); DocumentReference reference2 = new DocumentReference("wiki", Arrays.asList("space1", "space2"), "page"); List<SpaceReference> spaceRefs2 = reference2.getSpaceReferences(); assertEquals(2, spaceRefs2.size()); assertEquals(new SpaceReference("space1", new WikiReference("wiki")), spaceRefs2.get(0)); assertEquals(new SpaceReference("space2", new SpaceReference("space1", new WikiReference("wiki"))), spaceRefs2.get(1)); }
@Transient public List<SpaceReference> getSpaceReferences() { List<SpaceReference> references = new ArrayList<SpaceReference>(); EntityReference reference = this; while (reference != null) { if (reference.getType() == EntityType.SPACE) { references.add((SpaceReference) reference); } reference = reference.getParent(); } Collections.reverse(references); return references; }
DocumentReference extends AbstractLocalizedEntityReference { @Transient public List<SpaceReference> getSpaceReferences() { List<SpaceReference> references = new ArrayList<SpaceReference>(); EntityReference reference = this; while (reference != null) { if (reference.getType() == EntityType.SPACE) { references.add((SpaceReference) reference); } reference = reference.getParent(); } Collections.reverse(references); return references; } }
DocumentReference extends AbstractLocalizedEntityReference { @Transient public List<SpaceReference> getSpaceReferences() { List<SpaceReference> references = new ArrayList<SpaceReference>(); EntityReference reference = this; while (reference != null) { if (reference.getType() == EntityType.SPACE) { references.add((SpaceReference) reference); } reference = reference.getParent(); } Collections.reverse(references); return references; } DocumentReference(EntityReference reference); protected  DocumentReference(EntityReference reference, EntityReference oldReference, EntityReference newReference);  DocumentReference(EntityReference reference, Locale locale);  DocumentReference(String wikiName, String spaceName, String pageName);  DocumentReference(String wikiName, String spaceName, String pageName, Locale locale);  DocumentReference(String wikiName, String spaceName, String pageName, String language);  DocumentReference(String wikiName, List<String> spaceNames, String pageName);  DocumentReference(String wikiName, List<String> spaceNames, String pageName, Locale locale);  DocumentReference(String pageName, SpaceReference parent);  DocumentReference(LocalDocumentReference localDocumentReference, WikiReference wikiReference);  DocumentReference(String pageName, SpaceReference parent, Locale locale); @Unstable  DocumentReference(String pageName, EntityReference parent, Map<String, Serializable> parameters);  DocumentReference(EntityReference reference, EntityReference parent); }
DocumentReference extends AbstractLocalizedEntityReference { @Transient public List<SpaceReference> getSpaceReferences() { List<SpaceReference> references = new ArrayList<SpaceReference>(); EntityReference reference = this; while (reference != null) { if (reference.getType() == EntityType.SPACE) { references.add((SpaceReference) reference); } reference = reference.getParent(); } Collections.reverse(references); return references; } DocumentReference(EntityReference reference); protected  DocumentReference(EntityReference reference, EntityReference oldReference, EntityReference newReference);  DocumentReference(EntityReference reference, Locale locale);  DocumentReference(String wikiName, String spaceName, String pageName);  DocumentReference(String wikiName, String spaceName, String pageName, Locale locale);  DocumentReference(String wikiName, String spaceName, String pageName, String language);  DocumentReference(String wikiName, List<String> spaceNames, String pageName);  DocumentReference(String wikiName, List<String> spaceNames, String pageName, Locale locale);  DocumentReference(String pageName, SpaceReference parent);  DocumentReference(LocalDocumentReference localDocumentReference, WikiReference wikiReference);  DocumentReference(String pageName, SpaceReference parent, Locale locale); @Unstable  DocumentReference(String pageName, EntityReference parent, Map<String, Serializable> parameters);  DocumentReference(EntityReference reference, EntityReference parent); @Transient WikiReference getWikiReference(); @Transient DocumentReference setWikiReference(WikiReference wikiReference); @Transient SpaceReference getLastSpaceReference(); @Transient List<SpaceReference> getSpaceReferences(); @Override DocumentReference replaceParent(EntityReference oldParent, EntityReference newParent); @Override DocumentReference replaceParent(EntityReference newParent); @Deprecated LocalDocumentReference getLocaleDocumentReference(); LocalDocumentReference getLocalDocumentReference(); @Override String toString(); }
DocumentReference extends AbstractLocalizedEntityReference { @Transient public List<SpaceReference> getSpaceReferences() { List<SpaceReference> references = new ArrayList<SpaceReference>(); EntityReference reference = this; while (reference != null) { if (reference.getType() == EntityType.SPACE) { references.add((SpaceReference) reference); } reference = reference.getParent(); } Collections.reverse(references); return references; } DocumentReference(EntityReference reference); protected  DocumentReference(EntityReference reference, EntityReference oldReference, EntityReference newReference);  DocumentReference(EntityReference reference, Locale locale);  DocumentReference(String wikiName, String spaceName, String pageName);  DocumentReference(String wikiName, String spaceName, String pageName, Locale locale);  DocumentReference(String wikiName, String spaceName, String pageName, String language);  DocumentReference(String wikiName, List<String> spaceNames, String pageName);  DocumentReference(String wikiName, List<String> spaceNames, String pageName, Locale locale);  DocumentReference(String pageName, SpaceReference parent);  DocumentReference(LocalDocumentReference localDocumentReference, WikiReference wikiReference);  DocumentReference(String pageName, SpaceReference parent, Locale locale); @Unstable  DocumentReference(String pageName, EntityReference parent, Map<String, Serializable> parameters);  DocumentReference(EntityReference reference, EntityReference parent); @Transient WikiReference getWikiReference(); @Transient DocumentReference setWikiReference(WikiReference wikiReference); @Transient SpaceReference getLastSpaceReference(); @Transient List<SpaceReference> getSpaceReferences(); @Override DocumentReference replaceParent(EntityReference oldParent, EntityReference newParent); @Override DocumentReference replaceParent(EntityReference newParent); @Deprecated LocalDocumentReference getLocaleDocumentReference(); LocalDocumentReference getLocalDocumentReference(); @Override String toString(); static final Type TYPE_PROVIDER; }