You've successfully subscribed to AEM News
Great! Next, complete checkout for full access to AEM News
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.

Spice up your Sling Models With Lombok

AEM Community
AEM Community

The Digital Foundation Blueprint provided by Adobe greatly streamlines AEM implementation methodology. WCM Core Components, an integral part of this blueprint provide key building blocks components for some of the most common use cases. To extend these core components, one of the recommended implementation pattern is the Sling Model Delegation Pattern.

In our experience, using this delegation pattern requires writing a lot of boiler plate code for e.g:

  • We have to implement every method defined by the interface and delegate it.
  • If new methods are introduced (for e.g when we upgrade to newer version of WCM Core Components), we need to implement those methods and delegate those also else, we may run into runtime or compile errors in some cases.

Lombok to the rescue!

Author: Varshish Bhanushali

Spice up your Sling Models With Lombok - INITIALYZE
Project Lombok can be used to spice up your java classes and generate boilerplate code automatically. Lombok annotations in classes combined with the Sling Model Delegation approach can significantly reduce the amount of code you need to write in your extended Sling Models.

AEM Community

The AEM Community powers a large portion of the AEM.News, and without the community this site wouldn't be what it is today.


Sign in or become a AEM News member to join the conversation.
Just enter your email below to get a log in link.