This issue has been created
 
 
XWiki Commons / cid:jira-generated-image-avatar-29da9c49-51e2-415d-9a57-717e254a17e9 XCOMMONS-3299 Open

CollectionTool should allow performing ordering using get("foo") and not only getFoo

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-57c2c111-3e3d-4bbb-94ee-72e5c82b5551 Simon Urli created this issue on 27/Mar/25 17:13
 
Summary: CollectionTool should allow performing ordering using get("foo") and not only getFoo
Issue Type: cid:jira-generated-image-avatar-29da9c49-51e2-415d-9a57-717e254a17e9 Improvement
Affects Versions: 17.1.0
Assignee: Unassigned
Components: Velocity
Created: 27/Mar/25 17:13
Priority: cid:jira-generated-image-static-major-591b3b35-0e2c-4004-9e22-f397d2e24303 Major
Reporter: Simon Urli
Description:

It's currently not possible using CollectionTool to performing ordering of xobjects based on their attributes, because the Object API only gives a #get() method and CollectionTool is looking for a getter with the attribute name. So we end up with error like that:

2025-03-27 15:26:19,310 [qtp1601292138-142 - http://localhost:8080/xwiki/bin/get/Main/WebHome?xpage=xpart&vm=commentsinline.vm] ERROR o.x.v.t.CollectionTool - exception encountered while sorting: Could not retrieve comparable value for 'date' from com.xpn.xwiki.api.Object@32406bb1: java.lang.NoSuchMethodException: Unknown property 'date' on class 'class com.xpn.xwiki.api.Object'

It would be handy to improve it to allow retrieve values from those #get() methods for sorting comparison.