org.xwiki.model.reference
Class ObjectReference

java.lang.Object
  extended by org.xwiki.model.reference.EntityReference
      extended by 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$
See Also:
Serialized Form

Constructor Summary
  ObjectReference(EntityReference reference)
          Constructor which would raise exceptions if the source entity reference does not have the appropriate type or parent, etc.
protected ObjectReference(EntityReference reference, EntityReference oldReference, EntityReference newReference)
          Clone an ObjectReference, but replace one of the parent in the chain by a new one.
  ObjectReference(String objectName, DocumentReference documentReference)
           
  ObjectReference(String wiki, String space, String document, String objectName)
          Deprecated. 
 
Method Summary
 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, extractReference, getName, getParameter, getParent, getReversedReferenceChain, getRoot, getType, hashCode, removeParent, setName, setParameter, setParameters, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

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 cloned
oldReference - the old parent that will be replaced
newReference - 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 object
documentReference - the reference of the parent document of the object

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 is
space - space where the parent document of the object is
document - parent document of the object
objectName - 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 class EntityReference
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 class EntityReference
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 class EntityReference
Parameters:
oldParent - the old parent that will be replaced
newParent - 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


Copyright © 2004-2012 XWiki. All Rights Reserved.