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@61c01f8c
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@1df4fd41, com.xpn.xwiki.api.Object@3f1ec5c4, com.xpn.xwiki.api.Object@7d49e73b, com.xpn.xwiki.api.Object@7eec12bf, com.xpn.xwiki.api.Object@3cc2fab2, com.xpn.xwiki.api.Object@24d8db48, com.xpn.xwiki.api.Object@192466de, com.xpn.xwiki.api.Object@24dd85b7, com.xpn.xwiki.api.Object@4b75c449]
objsAuthors = doc.getObjects('XWiki.XWikiComments').author
objsAuthor = doc.getObjects('XWiki.XWikiComments')[2].author
println objs[0].author
println objsAuthors
println objsAuthor