Package org.xwiki.model.reference
Class LocalPageReference
- java.lang.Object
-
- org.xwiki.model.reference.EntityReference
-
- org.xwiki.model.reference.AbstractLocalizedEntityReference
-
- org.xwiki.model.reference.LocalPageReference
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<EntityReference>
public class LocalPageReference extends AbstractLocalizedEntityReference
Represents a reference to a page in the current wiki.- Since:
- 10.6RC1
- Version:
- $Id: f5ce8f498b5500899ce3706159aa8a36a25a0939 $
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.xwiki.model.reference.AbstractLocalizedEntityReference
LOCALE
-
Fields inherited from class org.xwiki.model.reference.EntityReference
TOSTRING_SERIALIZER
-
-
Constructor Summary
Constructors Constructor Description LocalPageReference(String pageName, String... pageNames)
Create a new Page reference in the current wiki.LocalPageReference(String pageName, Locale locale)
Create a new Page reference in the current wiki.LocalPageReference(String pageName, EntityReference pageReference)
Create a new Page reference in the current wiki.LocalPageReference(List<String> pageNames)
Create a new Page reference in the current wiki.LocalPageReference(EntityReference reference)
LocalPageReference(EntityReference entityReference, Locale locale)
LocalPageReference(EntityReference reference, EntityReference parent)
Clone an DocumentVersionReference, but use the specified parent for its new parent.LocalPageReference(PageReference pageReference)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LocalPageReference
replaceParent(EntityReference newParent)
Return a clone of this reference, but with its parent replaced by the passed one.protected void
setParent(EntityReference parent)
Entity reference are immutable since 3.3M2, so this method is now protected.protected void
setType(EntityType type)
Entity reference are immutable since 3.3M2, so this method is now protected.String
toString()
-
Methods inherited from class org.xwiki.model.reference.AbstractLocalizedEntityReference
getLocale, setLocale, setParameter
-
Methods inherited from class org.xwiki.model.reference.EntityReference
appendParent, compareTo, equals, equals, equals, equalsNonRecursive, extractFirstReference, extractReference, getName, getParameter, getParameters, getParent, getReversedReferenceChain, getRoot, getType, hashCode, hasParent, removeParent, replaceParent, setName, setParameters, size
-
-
-
-
Constructor Detail
-
LocalPageReference
public LocalPageReference(String pageName, String... pageNames)
Create a new Page reference in the current wiki.- Parameters:
pageName
- the name of the page containing the page, must not be nullpageNames
- an ordered list of the names of the pages containing the page from root page to last one, must not be null
-
LocalPageReference
public LocalPageReference(List<String> pageNames)
Create a new Page reference in the current wiki.- Parameters:
pageNames
- an ordered list of the names of the pages containing the page from root page to last one, must not be null
-
LocalPageReference
public LocalPageReference(String pageName, Locale locale)
Create a new Page reference in the current wiki.- Parameters:
pageName
- the name of the page containing the page, must not be nulllocale
- the new locale for this reference
-
LocalPageReference
public LocalPageReference(EntityReference reference)
- Parameters:
reference
- the reference to clone
-
LocalPageReference
public LocalPageReference(EntityReference entityReference, Locale locale)
- Parameters:
entityReference
- the referencelocale
- the new locale for this reference, if null, locale is removed
-
LocalPageReference
public LocalPageReference(String pageName, EntityReference pageReference)
Create a new Page reference in the current wiki.- Parameters:
pageName
- the name of the page, must not be nullpageReference
- the reference of the page, must not be null
-
LocalPageReference
public LocalPageReference(PageReference pageReference)
- Parameters:
pageReference
- the full page reference
-
LocalPageReference
public LocalPageReference(EntityReference reference, EntityReference parent)
Clone an DocumentVersionReference, but use the specified parent for its new parent.- Parameters:
reference
- the reference to cloneparent
- the new parent to use- Since:
- 10.8RC1
-
-
Method Detail
-
setParent
protected void setParent(EntityReference parent)
Entity reference are immutable since 3.3M2, so this method is now protected.Overridden in order to verify the validity of the passed parent.
- Overrides:
setParent
in classEntityReference
- Parameters:
parent
- the parent for this entity, may be null for a root entity.- Throws:
IllegalArgumentException
- if the passed parent is not a valid page reference parent (ie either a page reference or null)- See Also:
EntityReference.setParent(EntityReference)
-
setType
protected void setType(EntityType type)
Entity reference are immutable since 3.3M2, so this method is now protected.Overridden in order to verify the validity of the passed type.
- Overrides:
setType
in classEntityReference
- Parameters:
type
- the type for this entity- Throws:
IllegalArgumentException
- if the passed type is not a page type- See Also:
EntityReference.setType(org.xwiki.model.EntityType)
-
replaceParent
public LocalPageReference replaceParent(EntityReference newParent)
Description copied from class:EntityReference
Return a clone of this reference, but with its parent replaced by the passed one.- Overrides:
replaceParent
in classEntityReference
- Parameters:
newParent
- the new parent that will replace the parent- Returns:
- a new reference with a amended parent chain
-
toString
public String toString()
- Overrides:
toString
in classEntityReference
-
-