org.xwiki.annotation.reference
Class IndexedObjectReference
java.lang.Object
org.xwiki.model.reference.EntityReference
org.xwiki.model.reference.ObjectReference
org.xwiki.annotation.reference.IndexedObjectReference
- All Implemented Interfaces:
- Serializable, Cloneable, Comparable<EntityReference>
public class IndexedObjectReference
- 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
getClassName() 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 getClassName().
- Since:
- 2.3M1
- Version:
- $Id: b7cccc6625dd24c8f840f671c1885aa5acd4d77b $
- See Also:
- Serialized Form
|
Field Summary |
protected String |
className
The class name of this object, as set by the caller. |
protected Integer |
objectNumber
The number of this object, as set by the caller. |
| Methods inherited from class org.xwiki.model.reference.EntityReference |
appendParent, compareTo, equals, extractReference, getName, getParameter, getParent, getReversedReferenceChain, getRoot, getType, hashCode, removeParent, setParameter, setParameters, toString |
className
protected String className
- The class name of this object, as set by the caller.
objectNumber
protected Integer objectNumber
- The number of this object, as set by the caller.
IndexedObjectReference
public IndexedObjectReference(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
IndexedObjectReference
public IndexedObjectReference(String className,
Integer objectNumber,
EntityReference parent)
- Builds an indexed object reference for the object of class
className with index objectNumber in
the document referenced by parent.
- Parameters:
className - 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
getClassName
public String getClassName()
- Returns:
- the name of the class of this object, as it was set by caller. I.e. no resolving is done from the value
set in the name of the 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.