How to add lombok to your project

How to add lombok to your project

build.gradle should looks like:

IntelliJ IDEA: Enable Annotation Processing should be checked

Enable annotation processing

Annotate class with your logger –
@Slf4j // or: @Log @CommonsLog @Log4j @Log4j2 @XSlf4j

or create log4j2.xml

add dependencies

and use log4j2

over Slf4j facade:

add dependency

 

@Getter
@Setter
@NoArgsConstructor

private @Id @Setter(AccessLevel.PROTECTED) Long id;

@RequiredArgsConstructor

@NonNull

@ToString(exclude=”id”)

@EqualsAndHashCode(exclude={“id”, “shape”})

@Data – @ToString, @EqualsAndHashCode, @Getter on all fields, @Setter on all non-final fields, and @RequiredArgsConstructor

@Value is the immutable variant of @Data

@Cleanup InputStream is = this.getClass().getResourceAsStream(“res.txt”);

https://projectlombok.org/

Leave a comment

Your email address will not be published. Required fields are marked *