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@6e06e7c4
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@479f00b6, com.xpn.xwiki.api.Object@17e7d176, com.xpn.xwiki.api.Object@7468a63c, com.xpn.xwiki.api.Object@279e8d9, com.xpn.xwiki.api.Object@11a5ffd4, com.xpn.xwiki.api.Object@293ec059, com.xpn.xwiki.api.Object@56c62836, com.xpn.xwiki.api.Object@6b7a1dbb, com.xpn.xwiki.api.Object@1e36171d]
objsAuthors = doc.getObjects('XWiki.XWikiComments').author
objsAuthor = doc.getObjects('XWiki.XWikiComments')[2].author
println objs[0].author
println objsAuthors
println objsAuthor