Toggle navigation
Log-in
Languages
English
Wiki Index
Page Index
User Index
ICT
Groovy
Wiki source code of
Groovy
Last modified by
Ricardo Rodríguez Fernández
on 2017/02/27 11:03
Export
Print preview
View Source
Children
Content
Comments (10)
Attachments
History
Information
×
Export
Export as PDF
Export as HTML
Cancel
Show line numbers
**Retrieve the first object (index [0]) among all objects attached to this page and class XWikiComments** {{code language="groovy"}} obj = doc.getObject('XWiki.XWikiComments') {{/code}} {{groovy}} obj = doc.getObject('XWiki.XWikiComments') println obj {{/groovy}} **Retrieve all objects attached to this page and of class XWikiComments** {{code language="groovy"}} objs = doc.getObjects('XWiki.XWikiComments') {{/code}} {{groovy}} objs = doc.getObjects('XWiki.XWikiComments') println objs {{/groovy}} **Retrieve the author property of all objects attached to this page and of class XWikiComments** {{code language="groovy"}} objsAuthors = doc.getObjects('XWiki.XWikiComments').author println objsAuthors {{/code}} {{groovy}} objsAuthors = doc.getObjects('XWiki.XWikiComments').author println objsAuthors {{/groovy}} **Retrieve the author property of the fifth object attached to this page and of class XWikiComments by index** {{code language="groovy"}} objsAuthor = doc.getObjects('XWiki.XWikiComments')[4].author println objsAuthor {{/code}} {{groovy}} objsAuthor = doc.getObjects('XWiki.XWikiComments')[4].author println objsAuthor {{/groovy}} **Retrieve the author property of the first object attached to this page and of class XWikiComments by index; objs was assigned above!** {{code language="groovy"}} println objs[0].author {{/code}} {{groovy}} println objs[0].author {{/groovy}}
Applications
Blog
Dashboard
User Index
More applications
Quick Links
Sandbox