[Question] where is getPage method in PageListItemImpl?

75 views
Skip to first unread message

Giuseppe B

unread,
Jul 31, 2020, 4:01:08 AM7/31/20
to AEM Core Components Developer Community
Hi, 
I was wondering why the method getPage, which returns the private page object, is not available in PageListItemImpl? 
I can see the getters which override the methods of ListItem interface are basically wrappers of Page methods and I am forced to resolve the page by its path if I need it. 
Considering the object is already available/computed but hidden and the class is related to the Page by definition and implementation, it make sense imho to provide getPage method in order to 
  • give the developer more flexibility in building custom components 
  • reduce computational time by removing the resource resolution

Please let me know if I am missing something.


Kindly Regards,
Giuseppe

Vlad Băilescu

unread,
Jul 31, 2020, 4:10:36 AM7/31/20
to AEM Core Components Developer Community
Hi Giuseppe,

The PageListItemImpl class implements ListItem and provides public access to methods defined in that interface. Any other public methods/properties would not be bound by an actual API. We could have a PageListItem interface that extends ListItem to add a getPage() method and switch PageListItemImpl to implement that. Then you would have a proper API for getting the page, if the ListItem is a PageListItem.

Since we encourage members of our community to get more involved into the development process, may I ask you to create an improvement issue on github and contribute a pull-request for this change?

Best,
Vlad

--
You received this message because you are subscribed to the Google Groups "AEM Core Components Developer Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aem-core-componen...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aem-core-components-dev/91ad97df-5acd-438f-b642-dc72839e943fo%40googlegroups.com.

Giuseppe B

unread,
Jul 31, 2020, 5:32:52 AM7/31/20
to AEM Core Components Developer Community
Hi Vlad,
I started looking into the code and I am already stuck because I saw a deprecation notice: I added the method getPage to ListItem and it clashes with the one defined in NavigationItem (it extends ListItem).
Besides I noticed the method List.getPages() which could be used to implement custom business logic, as I mentioned before, but it is deprecated too. 

It seems to me I am trying to go down a path which has already been explored and it led to the current state of the repository.
To unsubscribe from this group and stop receiving emails from it, send an email to aem-core-components-dev+unsub...@googlegroups.com.

Vlad Băilescu

unread,
Jul 31, 2020, 5:46:43 AM7/31/20
to AEM Core Components Developer Community
Hi,

Adding getPage() to ListItem is probably not a good idea as not all items will be backed by pages. That's why we deprecated List.getItems() and NavigationItem.getPage(). The cleanest way to do it would be to create a page-based list item, hence my PageListItem suggestion.

Best,
Vlad


Hi Vlad,
To unsubscribe from this group and stop receiving emails from it, send an email to aem-core-componen...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "AEM Core Components Developer Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aem-core-componen...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aem-core-components-dev/998ce37f-55be-472a-8905-f80733516eedo%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages