[MGNLUI-5172] Add more annotation driven type aliases for UI component parts Created: 29/Apr/19  Updated: 25/Nov/19  Resolved: 09/Aug/19

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: None
Fix Version/s: 6.2

Type: Improvement Priority: Neutral
Reporter: Aleksandr Pchelintcev Assignee: Federico Grilli
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to MGNLUI-5027 Use type aliases in framework Closed
documentation
to be documented by MGNLUI-5311 DOC: More annotation-driven type alia... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Documentation update required:
Yes
Date of First Response:
Epic Link: Simpler YAML Configurations
Sprint: UI Framework 2, UI Framework 3
Story Points: 5

 Description   

Spread the initiative on such interfaces as:

  • converters
  • validators
  • item retreival strategies
  • ...


 Comments   
Comment by Federico Grilli [ 06/Aug/19 ]

It may be overkill but while I was adding the annotations, I thought if it would make sense to add those via some sort of bytecode manipulation for all classes in ui-framework and ui-framework-jcr (and possibly other modules too), ending with Definition. An agent may eventually instrument those classes during Maven's process-classes phase and produce the enhanced classes  https://www.baeldung.com/java-asm
This way we won't need to periodically catch up with new or changed definitions. I guess that is doable by relying on some sensible convention, e.g. all defs under actions package will be instrumented with an @ActionType. The shortcut name would be inferred from the action definition itself still via some convention, e.g.OpenDetailSubappActionDefinition -> openDetailSubappAction

Comment by Federico Grilli [ 08/Aug/19 ]

For the docu ppl, the following new aliases are provided:

Drop constraints

  • jcrDropConstraint

Item providers

  • delegateToSubNodeProvider
  • fetchJcrSubNodeProvider
  • fetchLocalizedJcrSubNodeProvider
  • jcrNodeFromLocationProvider
  • jcrNodeProvider

Datasources

  • jcrDatasource
  • enumDatasource
  • optionListDatasource

Editors

  • multiFormEditor
  • switchableForm

Actions

  • chainedAction
  • openDialogAction

Layouts

  • declarativeLayout
  • tabbedLayout
  • defaultEditorActionLayout

Fields

  • switchableField

Columns

  • dateColumn
  • columnComponent

Order handlers

  • jcrChildNodeOrderHandler

As a general rule one can guess the aliases by the following rules (there may be some exceptions though).

From class definition name

  • keep camel case for all letters but the first one
  • strip the Definition suffix (if any)

E.g.

  • JcrDatasourceDefinition -> jcrDatasource
  • OpenDialogActionDefinition -> openDialogAction
  • JcrDropConstraint -> jcrDropConstraint
Generated at Mon Feb 12 09:23:54 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.