Package com.xpn.xwiki.api
Class Object
- java.lang.Object
-
- com.xpn.xwiki.api.Api
-
- com.xpn.xwiki.api.Element
-
- com.xpn.xwiki.api.Collection
-
- com.xpn.xwiki.api.Object
-
public class Object extends Collection
-
-
Constructor Summary
Constructors Constructor Description Object(BaseObject obj, XWikiContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
display(String name, String mode)
Display the property with the passed name in the context of its own document.Object
display(String name, String mode, boolean isolated)
Display the property with the passed name in the context of the current document or its own document.boolean
equals(Object arg0)
Object
get(String name)
Display the passed field.protected BaseObject
getBaseObject()
String
getGuid()
ObjectPropertyReference
getPropertyReference(String propertyName)
Helper method used to obtain the reference of an object property even when the object might not have the property (e.g.BaseObjectReference
getReference()
BaseObject
getXWikiObject()
void
set(String fieldname, Object value)
void
setGuid(String guid)
-
Methods inherited from class com.xpn.xwiki.api.Collection
getCollection, getName, getNumber, getPrettyName, getProperties, getProperty, getPropertyNames, getValue, getxWikiClass
-
Methods inherited from class com.xpn.xwiki.api.Element
getBaseElement, getDocumentReference
-
Methods inherited from class com.xpn.xwiki.api.Api
convert, convert, convert, convertAttachments, getAuthorizationManager, getContextualAuthorizationManager, getXWikiContext, hasAccess, hasAccessLevel, hasAdminRights, hasProgrammingRights, hasWikiAdminRights
-
-
-
-
Constructor Detail
-
Object
public Object(BaseObject obj, XWikiContext context)
-
-
Method Detail
-
getBaseObject
protected BaseObject getBaseObject()
-
getXWikiObject
public BaseObject getXWikiObject()
-
getGuid
public String getGuid()
-
setGuid
public void setGuid(String guid)
-
get
public Object get(String name)
Display the passed field.This method's name is misleading since it doesn't return the Object's property value; it"s equivalent to
display(String, String)
(withtype
equals to the context action ("view" or "edit" usually). The right method to get the field value isCollection.getValue(String)
.
-
display
public Object display(String name, String mode)
Display the property with the passed name in the context of its own document.- Parameters:
name
- the name of the propertymode
- the edit mode in which the property should be displayed ("view", "edit", etc.)- Returns:
- the result of the display, generally HTML
-
display
public Object display(String name, String mode, boolean isolated)
Display the property with the passed name in the context of the current document or its own document.- Parameters:
name
- the name of the propertymode
- the edit mode in which the property should be displayed ("view", "edit", etc.)isolated
- true if the property should be displayed in it's own document context- Since:
- 13.0
-
getReference
public BaseObjectReference getReference()
- Overrides:
getReference
in classElement
- Returns:
- the reference of the element
-
getPropertyReference
public ObjectPropertyReference getPropertyReference(String propertyName)
Helper method used to obtain the reference of an object property even when the object might not have the property (e.g. because it's a computed property which doesn't have a stored value so it's not saved on the object). This is a safe alternative togetProperty(propertyName).getReference()
when you're not sure whether the object has the specified property or not.- Parameters:
propertyName
- the property name- Returns:
- the object property reference
- Since:
- 12.10.11, 13.4.6, 13.10RC1
- See Also:
- XWIKI-19031: Computed fields are stored as empty string properties in the database
-
-