-
Notifications
You must be signed in to change notification settings - Fork 12
CT Project Lombok
You will have to first install Project Lombok for your IDE
Follow the steps mentioned on this page if your IDE is Eclipse, else checkout their install page for other IDEs. They have support for various Eclipse offshoots in addition to Intellij IDEA, Netbeans and Visual Studio Code.
We do this by using the @Data
annotation available to us through the lombok library.
First we need to import the mentioned annotation. This is done by adding the line import lombok.Data
to your import list of your class. After this annotate your class with @Data
. Example. And just like this you can now take advantage of the @Data
annotation. The advantages have been mentioned below and have been quoted directly from here.
@Data generates all the boilerplate that is normally associated with simple POJOs (Plain Old Java Objects) and beans: getters for all fields, setters for all non-final fields, and appropriate toString, equals and hashCode implementations that involve the fields of the class, and a constructor that initializes all final fields, as well as all non-final fields with no initializer that have been marked with @NonNull, in order to ensure the field is never null.
@Data is like having implicit @Getter, @Setter, @ToString, @EqualsAndHashCode and @RequiredArgsConstructor annotations on the class (except that no constructor will be generated if any explicitly written constructors already exist).
- Development Workflow
- Coding Standards
- Coding Style
- Code Profile
- Coding Tutorials
- Branch History
- Refactoring Suggestions