Package org.xwiki.model.reference
Class ObjectReference
- java.lang.Object
-
- org.xwiki.model.reference.EntityReference
-
- org.xwiki.model.reference.ObjectReference
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<EntityReference>
public class ObjectReference extends EntityReference
Reference to an object in a document (by classname and index, document, space, wiki).- Since:
- 2.3M1
- Version:
- $Id: ca7100f9a25ab7c6ef45aefba65fa48b6a7d56b1 $
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.xwiki.model.reference.EntityReference
TOSTRING_SERIALIZER
-
-
Constructor Summary
Constructors Modifier Constructor Description ObjectReference(String wiki, String space, String document, String objectName)
Deprecated.ObjectReference(String objectName, DocumentReference documentReference)
ObjectReference(EntityReference reference)
Constructor which would raise exceptions if the source entity reference does not have the appropriate type or parent, etc.ObjectReference(EntityReference reference, EntityReference parent)
Clone an ObjectReference, but use the specified parent for its new parent.protected
ObjectReference(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 DocumentReference
getDocumentReference()
ObjectReference
replaceParent(EntityReference newParent)
Return a clone of this reference, but with its parent replaced by the passed one.ObjectReference
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
-
ObjectReference
public ObjectReference(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
-
ObjectReference
protected ObjectReference(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- Since:
- 3.3M2
-
ObjectReference
public ObjectReference(String objectName, DocumentReference documentReference)
- Parameters:
objectName
- the name of the objectdocumentReference
- the reference of the parent document of the object
-
ObjectReference
public ObjectReference(EntityReference reference, EntityReference parent)
Clone an ObjectReference, but use the specified parent for its new parent.- Parameters:
reference
- the reference to cloneparent
- the new parent to use- Since:
- 10.8RC1
-
ObjectReference
@Deprecated public ObjectReference(String wiki, String space, String document, String objectName)
Deprecated.Deprecated constructor.- Parameters:
wiki
- wiki where the parent document of the object isspace
- space where the parent document of the object isdocument
- parent document of the objectobjectName
- the name of the object
-
-
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 document.
- 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 ObjectReference 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 ObjectReference 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
-
getDocumentReference
public DocumentReference getDocumentReference()
- Returns:
- the reference of the document holding this object
- Since:
- 9.8RC1
-
-