@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); } }