[Docs] consistent lombok annotation (#31290)

This commit is contained in:
xiaozhiliaoo(小知了) 2022-04-02 00:44:04 +08:00 committed by GitHub
parent 313fde32e1
commit 305220459b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -37,14 +37,14 @@ To add Lombok to a Maven project, declare it as a simple dependency:
String email; String email;
} }
The example does not demonstrate other useful Lombok features like `@Builder` or `@Wither` which will help The example does not demonstrate other useful Lombok features like `@Builder` or `@With` which will help
you create builder and copy methods. Be aware that Lombok is not an immutability library but a you create builder and copy methods. Be aware that Lombok is not an immutability library but a
code generation library which means some setups might not create immutable objects. code generation library which means some setups might not create immutable objects.
For example, Lomboks @Data is equivalent to Lomboks @Value but will also synthesize mutable methods. For example, Lomboks `@Data` is equivalent to Lomboks `@Value` but will also synthesize mutable methods.
Dont use Lomboks @Data when creating immutable classes. Dont use Lomboks `@Data` when creating immutable classes.
Using Lombok for creating a message class for actors is quite simple. In following example, Message class Using Lombok for creating a message class for actors is quite simple. In following example, Message class
just defines the member variable and Lombok annotation '@Value' takes care of creating methods like just defines the member variable and Lombok annotation `@Value` takes care of creating methods like
getter, toString, hashCode, equals. getter, toString, hashCode, equals.
public class MyActor extends AbstractActor { public class MyActor extends AbstractActor {