lombok annotation description

@NonNull : Annotated on the parameter, if the parameter of this class is null, an exception will be reported, throw new NullPointException (parameter name)
@Cleanup : Annotated before referencing the variable, the resource is automatically reclaimed and the close() method is called by default
@Getter/@ Setter : Annotated on the class, provides read-write properties for the class @Getter
(lazy=true) :
@ToString : Annotated on the class, provides the toString() method for the class
@EqualsAndHashCode : Annotated on the class, provides equals() for the class And the hashCode() method
@NoArgsConstructor,: Annotated on the class, provides a no-argument constructor,
@RequiredArgsConstructor: Annotated on the class, provides a constructor that specifies required parameters, 
@AllArgsConstructor: Annotation provides a full-parameter constructor
@Data on the class: Annotated on the class, provides read and write properties for the class, and also provides equals(), hashCode(), toString() methods
@Value :
@Builder : Annotated on the class, provides an internal Builder for the class
@SneakThrows :
@ Synchronized : Annotated on the method, provides a synchronization lock for the method
@Log :
@Log4j : Annotated on the class, provides the class with a log4j log object with an attribute named log
@Slf4j : Annotated on the class, providing a log4j log object with a property named log for the class.
Example:
@Cleanup("dispose") HelloJava helloJava = new HelloJava();
@Cleanup InputStream in = new FileInputStream(new File ("path"));
@Cleanup OutputStream out = new FileOutputStream(new File("path"));

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326023453&siteId=291194637