lombok的@Accessors注解

@AllArgsConstructor
@Data
@NoArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode
public class User {
    String name;
    String sex;
    String num;
}

 

使用:

package com.example.springbootstarterhello.chain;

public class TestChain {
    public static void main(String[] args) {
        User user = new User();
       /* user.setSex("ede");
        user.setNum("32323");*/
        user.setName("ego").setNum("123").setSex("male");
        System.out.println(user);
    }
}

 

上一篇:(翻译) closures-are-not-complicated


下一篇:Product Distribution chain id F4 value help的实现