해당 옵션은 직렬화에서 제거하고 싶은 변수에 사용하면 된다.
@AllArgsConstructor
@ToString
static class NoTransientMember implements Serializable {
private String name;
private String age;
}
@AllArgsConstructor
@ToString
static class TransientMember implements Serializable{
private transient String name;
private String age;
}
결과
serialize = rO0ABXNyADpjb20uc2hpbmhhbmRzLmxpYi5zZXJ2aWNlLlNFMkVDbGllbnRUZXN0JE5vVHJhbnNpZW50TWVtYmVyQgSIOhJ54SYCAAJMAANhZ2V0ABJMamF2YS9sYW5nL1N0cmluZztMAARuYW1lcQB+AAF4cHQAAjIydAADa2lt
serialize1 = rO0ABXNyADhjb20uc2hpbmhhbmRzLmxpYi5zZXJ2aWNlLlNFMkVDbGllbnRUZXN0JFRyYW5zaWVudE1lbWJlcupDIVondWvYAgABTAADYWdldAASTGphdmEvbGFuZy9TdHJpbmc7eHB0AAIyMw==
SE2EClientTest.TransientMember(name=null, age=23)
SE2EClientTest.NoTransientMember(name=kim, age=22)