class DocumentReference extends EntityReference {

    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();
        }
        // Reverse the array so that the last entry is the parent of the Document Reference
        Collections.reverse(references);

        return references;
    }

    public  DocumentReference(EntityReference reference);
    public  DocumentReference(String wikiName, String spaceName, String pageName);
    public  DocumentReference(String wikiName, List<String> spaceNames, String pageName);
    public  DocumentReference(String pageName, SpaceReference parent);

}