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@15109fdd
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@c96325e, com.xpn.xwiki.api.Object@58c4bfc6, com.xpn.xwiki.api.Object@5d0a8db1, com.xpn.xwiki.api.Object@5fdc8f2f, com.xpn.xwiki.api.Object@93c87d4, com.xpn.xwiki.api.Object@64f97408, com.xpn.xwiki.api.Object@3530ed02, com.xpn.xwiki.api.Object@1f183996, com.xpn.xwiki.api.Object@6f6cb6cc]
objsAuthors = doc.getObjects('XWiki.XWikiComments').author
objsAuthor = doc.getObjects('XWiki.XWikiComments')[2].author
println objs[0].author
println objsAuthors
println objsAuthor