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@b13f9eb
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@1e24afa5, com.xpn.xwiki.api.Object@7a878918, com.xpn.xwiki.api.Object@5839c580, com.xpn.xwiki.api.Object@38d583c0, com.xpn.xwiki.api.Object@49bccf66, com.xpn.xwiki.api.Object@ad4575c, com.xpn.xwiki.api.Object@7ab35e91, com.xpn.xwiki.api.Object@1605c086, com.xpn.xwiki.api.Object@53a2a8b5]
objsAuthors = doc.getObjects('XWiki.XWikiComments').author
objsAuthor = doc.getObjects('XWiki.XWikiComments')[2].author
println objs[0].author
println objsAuthors
println objsAuthor