Package org.xwiki.model.reference
Class PageObjectReference
- java.lang.Object
-
- org.xwiki.model.reference.EntityReference
-
- org.xwiki.model.reference.PageObjectReference
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<EntityReference>
public class PageObjectReference extends EntityReference
Reference to an object in a page (by classname and index, page, wiki).- Since:
- 10.6RC1
- Version:
- $Id: 0e6f1f1548463b6de63a8f8900de8294051e3e69 $
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.xwiki.model.reference.EntityReference
TOSTRING_SERIALIZER
-
-
Constructor Summary
Constructors Modifier Constructor Description PageObjectReference(String objectName, PageReference pageReference)
PageObjectReference(EntityReference reference)
Constructor which would raise exceptions if the source entity reference does not have the appropriate type or parent, etc.PageObjectReference(EntityReference reference, EntityReference parent)
Clone an PageObjectReference, but use the specified parent for its new parent.protected
PageObjectReference(EntityReference reference, EntityReference oldReference, EntityReference newReference)
Clone an ObjectReference, but replace one of the parent in the chain by a new one.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PageReference
getPageReference()
PageObjectReference
replaceParent(EntityReference newParent)
Return a clone of this reference, but with its parent replaced by the passed one.PageObjectReference
replaceParent(EntityReference oldParent, EntityReference newParent)
Return a clone of this reference, but with one of its parent replaced by another 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.-
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, setName, setParameter, setParameters, size, toString
-
-
-
-
Constructor Detail
-
PageObjectReference
public PageObjectReference(EntityReference reference)
Constructor which would raise exceptions if the source entity reference does not have the appropriate type or parent, etc.- Parameters:
reference
- the raw reference to build this object reference from
-
PageObjectReference
protected PageObjectReference(EntityReference reference, EntityReference oldReference, EntityReference newReference)
Clone an ObjectReference, but replace one of the parent in the chain by a new one.- Parameters:
reference
- the reference that is clonedoldReference
- the old parent that will be replacednewReference
- the new parent that will replace oldReference in the chain
-
PageObjectReference
public PageObjectReference(String objectName, PageReference pageReference)
- Parameters:
objectName
- the name of the objectpageReference
- the reference of the parent page of the object
-
PageObjectReference
public PageObjectReference(EntityReference reference, EntityReference parent)
Clone an PageObjectReference, 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
-
setType
protected void setType(EntityType type)
Entity reference are immutable since 3.3M2, so this method is now protected.Overridden to check the type to be an object type.
- Overrides:
setType
in classEntityReference
- Parameters:
type
- the type for this entity- See Also:
EntityReference.setType(org.xwiki.model.EntityType)
-
setParent
protected void setParent(EntityReference parent)
Entity reference are immutable since 3.3M2, so this method is now protected.Overridden to ensure that the parent of an object is always a page.
- Overrides:
setParent
in classEntityReference
- Parameters:
parent
- the parent for this entity, may be null for a root entity.- See Also:
EntityReference.setParent(org.xwiki.model.reference.EntityReference)
-
replaceParent
public PageObjectReference replaceParent(EntityReference oldParent, EntityReference newParent)
Description copied from class:EntityReference
Return a clone of this reference, but with one of its parent replaced by another one.- Overrides:
replaceParent
in classEntityReference
- Parameters:
oldParent
- the old parent that will be replacednewParent
- the new parent that will replace oldParent in the chain. If the same as oldParent, this is returned.- Returns:
- a new reference with a amended parent chain
-
replaceParent
public PageObjectReference 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
-
getPageReference
public PageReference getPageReference()
- Returns:
- the reference of the page holding this object
-
-