Class 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: 97aa558603c7018027279507cfa825b2728b1d52 $
    See Also:
    Serialized Form
    • Field Detail

      • 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.
    • Constructor Detail

      • 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 object
        objectNumber - the number of the object in the document, or null if the default object should be referenced
        parent - reference to the parent document where the object is
    • Method Detail

      • 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.