Home » Tip Bank » Java
  • Comment on this Article
Language: Java
Expertise: Intermediate
Jul 2, 2019
  • facebook
  • twitter
  • in
  • Email

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Watch

How to Annotate Class with Lombok

The first approach consists of annotating the class as below:

@ToString
@EqualsAndHashCode
@Getter
@Setter
@RequiredArgsConstructor
public class Foo {
   ...
}

A shortcut for @ToString, @EqualsAndHashCode, @Getter on all fields, @Setter on all non-final fields, and @RequiredArgsConstructor is @Data as follows:

@Data
public class Foo {
   ...
}
OCTAVIA ANDREEA
 
Submit a Tip
Browse "Java" Tips
Browse All Tips
codecademy.com
w3schools.com