com.xpn.xwiki.objects
Class BaseObjectReference
java.lang.Object
org.xwiki.model.reference.EntityReference
org.xwiki.model.reference.ObjectReference
com.xpn.xwiki.objects.BaseObjectReference
- All Implemented Interfaces:
- Serializable, Cloneable, Comparable<EntityReference>
public class BaseObjectReference
- extends ObjectReference
Object reference implementation for object names generated in className[objectNumber]
format. It provides
helper functions to extract the class name as specified by the caller, and object number.
Accepted formats for the object name are:
- className[objectNumber]
- interpreted as the object of class className with number objectNumber. refers the object returned by
XWikiDocument.getObject(String className, int objectNumber). In this case, className is obtained by calling
getXClassReference()
and object index by calling getObjectNumber()
.
- className
- interpreted as the first object of class className. refers the object returned by XWikiDocument.getObject(String
className). In this case,
getObjectNumber()
will return null
and className
is obtained by
calling getXClassReference()
.
- Version:
- $Id: 8d4e3d773c317d2f21cdef22a5cff9e8a8be2bef $
- See Also:
- Serialized Form
Methods inherited from class org.xwiki.model.reference.EntityReference |
appendParent, compareTo, equals, extractReference, getName, getParameter, getParent, getReversedReferenceChain, getRoot, getType, hashCode, removeParent, setParameter, setParameters, toString |
xclassReference
protected DocumentReference xclassReference
- The class reference of this object.
objectNumber
protected Integer objectNumber
- The number of this object.
BaseObjectReference
public BaseObjectReference(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
BaseObjectReference
public BaseObjectReference(DocumentReference classReference,
Integer objectNumber,
DocumentReference parent)
- Builds an indexed object reference for the object of class
className
with index objectNumber
in
the document referenced by parent
.
- Parameters:
classReference
- the name of the class of the objectobjectNumber
- the number of the object in the document, or null
if the default object should be
referencedparent
- reference to the parent document where the object is
getXClassReference
public DocumentReference getXClassReference()
- Returns:
- the reference of the class of this object.
getObjectNumber
public Integer getObjectNumber()
- Returns:
- the number of this object among the objects of the same class in the document, as set by the caller in
[objectNumber] format after the class name (i.e. no resolving is done, existence of this object is not
guaranteed). If no number can be parsed (i.e. [number] cannot be parsed) this function returns
null
and object should be interpreted as the first object of this class in the document.
setName
protected void setName(String name)
-
Overridden to always compute the class name and the object number.
- Overrides:
setName
in class EntityReference
- See Also:
EntityReference.setName(java.lang.String)
Copyright © 2004-2013 XWiki. All Rights Reserved.