Groovy
Retrieve the first object (index [0]) among all objects attached to this page and of a certain class
obj = doc.getObject('XWiki.XWikiComments')
com.xpn.xwiki.api.Object@2e9f82f5
Retrieve all objects attached to this page and of a certain class and one of their properties
objs = doc.getObjects('XWiki.XWikiComments')
[com.xpn.xwiki.api.Object@1b774d80, com.xpn.xwiki.api.Object@35811c96, com.xpn.xwiki.api.Object@2f7bd74b, com.xpn.xwiki.api.Object@6b739547, com.xpn.xwiki.api.Object@714d9f6d, com.xpn.xwiki.api.Object@1f1de738, com.xpn.xwiki.api.Object@64371d7d, com.xpn.xwiki.api.Object@5e712cf1, com.xpn.xwiki.api.Object@583db2a7]
objsAuthors = doc.getObjects('XWiki.XWikiComments').author
objsAuthor = doc.getObjects('XWiki.XWikiComments')[2].author
println objs[0].author
println objsAuthors
println objsAuthor