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@721e3c23
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@77b42b34, com.xpn.xwiki.api.Object@5580a051, com.xpn.xwiki.api.Object@6f9d51b1, com.xpn.xwiki.api.Object@415e74b6, com.xpn.xwiki.api.Object@20407a41, com.xpn.xwiki.api.Object@691a51f1, com.xpn.xwiki.api.Object@3ef9db1f, com.xpn.xwiki.api.Object@5a0f086, com.xpn.xwiki.api.Object@90ef04d]
objsAuthors = doc.getObjects('XWiki.XWikiComments').author
objsAuthor = doc.getObjects('XWiki.XWikiComments')[2].author
println objs[0].author
println objsAuthors
println objsAuthor