4
4
import io .github .wassertim .dynamodb .toolkit .api .annotations .Table ;
5
5
import io .github .wassertim .dynamodb .toolkit .api .annotations .PartitionKey ;
6
6
import io .github .wassertim .dynamodb .toolkit .api .annotations .SortKey ;
7
+ import lombok .AllArgsConstructor ;
8
+ import lombok .Builder ;
9
+ import lombok .Data ;
10
+ import lombok .NoArgsConstructor ;
7
11
8
12
import java .time .Instant ;
9
13
import java .util .List ;
15
19
*/
16
20
@ DynamoMappable
17
21
@ Table (name = "test-users" )
22
+ @ Data
23
+ @ Builder
24
+ @ NoArgsConstructor
25
+ @ AllArgsConstructor
18
26
public class TestUser {
19
27
20
28
@ PartitionKey
@@ -30,23 +38,7 @@ public class TestUser {
30
38
private List <String > tags ;
31
39
private TestProfile profile ; // Will require TestProfile to also be @DynamoMappable
32
40
33
- // Default constructor for DynamoDB
34
- public TestUser () {}
35
-
36
- // Builder constructor
37
- public TestUser (String userId , String email , String name , Integer age , Boolean active ,
38
- Instant createdAt , List <String > tags , TestProfile profile ) {
39
- this .userId = userId ;
40
- this .email = email ;
41
- this .name = name ;
42
- this .age = age ;
43
- this .active = active ;
44
- this .createdAt = createdAt ;
45
- this .tags = tags ;
46
- this .profile = profile ;
47
- }
48
-
49
- // Getters and setters
41
+ // Manual getters/setters for now (Lombok should generate these)
50
42
public String getUserId () { return userId ; }
51
43
public void setUserId (String userId ) { this .userId = userId ; }
52
44
@@ -71,77 +63,37 @@ public TestUser(String userId, String email, String name, Integer age, Boolean a
71
63
public TestProfile getProfile () { return profile ; }
72
64
public void setProfile (TestProfile profile ) { this .profile = profile ; }
73
65
74
- // Builder pattern methods
75
- public static Builder builder () {
76
- return new Builder ();
77
- }
66
+ // Manual builder for now (Lombok should generate this)
67
+ public static TestUserBuilder builder () { return new TestUserBuilder (); }
78
68
79
- public static class Builder {
80
- private String userId ;
81
- private String email ;
82
- private String name ;
69
+ public static class TestUserBuilder {
70
+ private String userId , email , name ;
83
71
private Integer age ;
84
72
private Boolean active ;
85
73
private Instant createdAt ;
86
74
private List <String > tags ;
87
75
private TestProfile profile ;
88
76
89
- public Builder userId (String userId ) {
90
- this .userId = userId ;
91
- return this ;
92
- }
93
-
94
- public Builder email (String email ) {
95
- this .email = email ;
96
- return this ;
97
- }
98
-
99
- public Builder name (String name ) {
100
- this .name = name ;
101
- return this ;
102
- }
103
-
104
- public Builder age (Integer age ) {
105
- this .age = age ;
106
- return this ;
107
- }
108
-
109
- public Builder active (Boolean active ) {
110
- this .active = active ;
111
- return this ;
112
- }
113
-
114
- public Builder createdAt (Instant createdAt ) {
115
- this .createdAt = createdAt ;
116
- return this ;
117
- }
118
-
119
- public Builder tags (List <String > tags ) {
120
- this .tags = tags ;
121
- return this ;
122
- }
123
-
124
- public Builder profile (TestProfile profile ) {
125
- this .profile = profile ;
126
- return this ;
127
- }
77
+ public TestUserBuilder userId (String userId ) { this .userId = userId ; return this ; }
78
+ public TestUserBuilder email (String email ) { this .email = email ; return this ; }
79
+ public TestUserBuilder name (String name ) { this .name = name ; return this ; }
80
+ public TestUserBuilder age (Integer age ) { this .age = age ; return this ; }
81
+ public TestUserBuilder active (Boolean active ) { this .active = active ; return this ; }
82
+ public TestUserBuilder createdAt (Instant createdAt ) { this .createdAt = createdAt ; return this ; }
83
+ public TestUserBuilder tags (List <String > tags ) { this .tags = tags ; return this ; }
84
+ public TestUserBuilder profile (TestProfile profile ) { this .profile = profile ; return this ; }
128
85
129
86
public TestUser build () {
130
- return new TestUser (userId , email , name , age , active , createdAt , tags , profile );
87
+ TestUser user = new TestUser ();
88
+ user .setUserId (userId );
89
+ user .setEmail (email );
90
+ user .setName (name );
91
+ user .setAge (age );
92
+ user .setActive (active );
93
+ user .setCreatedAt (createdAt );
94
+ user .setTags (tags );
95
+ user .setProfile (profile );
96
+ return user ;
131
97
}
132
98
}
133
-
134
- @ Override
135
- public String toString () {
136
- return "TestUser{" +
137
- "userId='" + userId + '\'' +
138
- ", email='" + email + '\'' +
139
- ", name='" + name + '\'' +
140
- ", age=" + age +
141
- ", active=" + active +
142
- ", createdAt=" + createdAt +
143
- ", tags=" + tags +
144
- ", profile=" + profile +
145
- '}' ;
146
- }
147
99
}
0 commit comments