Skip to content

Commit 3d65ea2

Browse files
committed
Make data classes non-final
1 parent 2d07a36 commit 3d65ea2

File tree

5 files changed

+220
-212
lines changed

5 files changed

+220
-212
lines changed
Lines changed: 61 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,61 @@
1-
package com.creatubbles.api.core;
2-
3-
import java.util.HashMap;
4-
5-
import jersey.repackaged.com.google.common.collect.Maps;
6-
import lombok.AccessLevel;
7-
import lombok.Getter;
8-
import lombok.ToString;
9-
import lombok.Value;
10-
11-
import com.google.gson.annotations.SerializedName;
12-
13-
@Value
14-
@ToString(callSuper = true)
15-
public class Creation extends CreatubblesObject {
16-
17-
String name;
18-
@SerializedName("created_at")
19-
String createdDate;
20-
@SerializedName("created_at_age")
21-
String createdAge;
22-
23-
@Getter(value = AccessLevel.NONE)
24-
@SerializedName("created_at_age_per_creator")
25-
HashMap<String, String> creatorToAgeMap = Maps.newHashMap();
26-
27-
public String getCreatedAge(String creatorId) {
28-
return creatorToAgeMap.get(creatorId);
29-
}
30-
31-
public String getCreatedAge(User creator) {
32-
return getCreatedAge(creator.getId());
33-
}
34-
35-
@SerializedName("created_at_month")
36-
int createdMonth;
37-
@SerializedName("created_at_year")
38-
int createdYear;
39-
@SerializedName("comments_count")
40-
int commentCount;
41-
@SerializedName("bubble_count")
42-
int bubbleCount;
43-
@SerializedName("views_count")
44-
int viewCount;
45-
46-
@SerializedName("last_bubbled_at")
47-
String lastBubbleDate;
48-
@SerializedName("last_commented_at")
49-
String lastCommentDate;
50-
@SerializedName("last_submitted_at")
51-
String lastSubmitDate;
52-
53-
Image image;
54-
55-
@SerializedName("short_url")
56-
String shortUrl;
57-
58-
boolean approved;
59-
}
1+
package com.creatubbles.api.core;
2+
3+
import java.util.HashMap;
4+
5+
import jersey.repackaged.com.google.common.collect.Maps;
6+
import lombok.AccessLevel;
7+
import lombok.Getter;
8+
import lombok.ToString;
9+
import lombok.Value;
10+
import lombok.experimental.NonFinal;
11+
12+
import com.google.gson.annotations.SerializedName;
13+
14+
@Value
15+
@ToString(callSuper = true)
16+
@NonFinal
17+
public class Creation extends CreatubblesObject {
18+
19+
String name;
20+
@SerializedName("created_at")
21+
String createdDate;
22+
@SerializedName("created_at_age")
23+
String createdAge;
24+
25+
@Getter(value = AccessLevel.NONE)
26+
@SerializedName("created_at_age_per_creator")
27+
HashMap<String, String> creatorToAgeMap = Maps.newHashMap();
28+
29+
public String getCreatedAge(String creatorId) {
30+
return creatorToAgeMap.get(creatorId);
31+
}
32+
33+
public String getCreatedAge(User creator) {
34+
return getCreatedAge(creator.getId());
35+
}
36+
37+
@SerializedName("created_at_month")
38+
int createdMonth;
39+
@SerializedName("created_at_year")
40+
int createdYear;
41+
@SerializedName("comments_count")
42+
int commentCount;
43+
@SerializedName("bubble_count")
44+
int bubbleCount;
45+
@SerializedName("views_count")
46+
int viewCount;
47+
48+
@SerializedName("last_bubbled_at")
49+
String lastBubbleDate;
50+
@SerializedName("last_commented_at")
51+
String lastCommentDate;
52+
@SerializedName("last_submitted_at")
53+
String lastSubmitDate;
54+
55+
Image image;
56+
57+
@SerializedName("short_url")
58+
String shortUrl;
59+
60+
boolean approved;
61+
}
Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
1-
package com.creatubbles.api.core;
2-
3-
import java.util.Map;
4-
5-
import lombok.EqualsAndHashCode;
6-
import lombok.ToString;
7-
8-
@ToString
9-
@EqualsAndHashCode
10-
public class Image {
11-
12-
private Map<ImageType, String> links;
13-
14-
public String getUrl(ImageType type) {
15-
return links.get(type);
16-
}
17-
18-
public enum ImageType {
19-
original,
20-
full_view,
21-
list_view_retina,
22-
list_view,
23-
matrix_view_retina,
24-
matrix_view,
25-
gallery_mobile,
26-
explore_mobile,
27-
share;
28-
}
29-
}
1+
package com.creatubbles.api.core;
2+
3+
import java.util.Map;
4+
5+
import lombok.EqualsAndHashCode;
6+
import lombok.ToString;
7+
import lombok.experimental.NonFinal;
8+
9+
@ToString
10+
@EqualsAndHashCode
11+
@NonFinal
12+
public class Image {
13+
14+
private Map<ImageType, String> links;
15+
16+
public String getUrl(ImageType type) {
17+
return links.get(type);
18+
}
19+
20+
public enum ImageType {
21+
original,
22+
full_view,
23+
list_view_retina,
24+
list_view,
25+
matrix_view_retina,
26+
matrix_view,
27+
gallery_mobile,
28+
explore_mobile,
29+
share;
30+
}
31+
}
Lines changed: 50 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,50 @@
1-
package com.creatubbles.api.core;
2-
3-
import lombok.Value;
4-
5-
/**
6-
* Created by Jevgeni on 10.03.2016.
7-
*/
8-
@Value
9-
public class LandingUrl {
10-
11-
LandingUrlType type;
12-
String url;
13-
14-
public enum LandingUrlType {
15-
16-
CTB_ABOUT_US("ctb-about_us"),
17-
CTB_TERMS_OF_USE("ctb-terms_of_use"),
18-
CTB_PRIVACY_POLICY("ctb-privacy_policy"),
19-
CTB_REGISTRATION("ctb-registration"),
20-
CTB_FORGOT_PASSWORD("ctb-forgot_password"),
21-
CTB_USER_PROFILE("ctb-user_profile"),
22-
CTB_EXPLORE("ctb-explore");
23-
24-
private String type;
25-
26-
public String getType() {
27-
return type;
28-
}
29-
30-
LandingUrlType(String type) {
31-
this.type = type;
32-
}
33-
34-
public static LandingUrlType from(String type) {
35-
for (LandingUrlType e : LandingUrlType.values()) {
36-
if (e.getType().equals(type)) {
37-
return e;
38-
}
39-
}
40-
throw new IllegalStateException();
41-
}
42-
43-
@Override
44-
public String toString() {
45-
return type;
46-
}
47-
}
48-
}
1+
package com.creatubbles.api.core;
2+
3+
import lombok.Value;
4+
import lombok.experimental.NonFinal;
5+
6+
/**
7+
* Created by Jevgeni on 10.03.2016.
8+
*/
9+
@Value
10+
@NonFinal
11+
public class LandingUrl {
12+
13+
LandingUrlType type;
14+
String url;
15+
16+
public enum LandingUrlType {
17+
18+
CTB_ABOUT_US("ctb-about_us"),
19+
CTB_TERMS_OF_USE("ctb-terms_of_use"),
20+
CTB_PRIVACY_POLICY("ctb-privacy_policy"),
21+
CTB_REGISTRATION("ctb-registration"),
22+
CTB_FORGOT_PASSWORD("ctb-forgot_password"),
23+
CTB_USER_PROFILE("ctb-user_profile"),
24+
CTB_EXPLORE("ctb-explore");
25+
26+
private String type;
27+
28+
public String getType() {
29+
return type;
30+
}
31+
32+
LandingUrlType(String type) {
33+
this.type = type;
34+
}
35+
36+
public static LandingUrlType from(String type) {
37+
for (LandingUrlType e : LandingUrlType.values()) {
38+
if (e.getType().equals(type)) {
39+
return e;
40+
}
41+
}
42+
throw new IllegalStateException();
43+
}
44+
45+
@Override
46+
public String toString() {
47+
return type;
48+
}
49+
}
50+
}
Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
1-
package com.creatubbles.api.core;
2-
3-
import lombok.ToString;
4-
import lombok.Value;
5-
6-
import com.google.gson.annotations.SerializedName;
7-
8-
@Value
9-
@ToString(callSuper = true)
10-
public class User extends CreatubblesObject {
11-
12-
String age;
13-
@SerializedName("birth_month")
14-
String birthMonth;
15-
@SerializedName("birth_year")
16-
String birthYear;
17-
18-
String username;
19-
@SerializedName("display_name")
20-
String displayName;
21-
String email, role;
22-
23-
@SerializedName("country_code")
24-
String countryCode;
25-
@SerializedName("country_name")
26-
String countryName;
27-
28-
@SerializedName("created_at")
29-
String createdDate;
30-
@SerializedName("short_url")
31-
String shortUrl;
32-
@SerializedName("avatar_url")
33-
String avatarUrl;
34-
35-
String gender, interests;
36-
}
1+
package com.creatubbles.api.core;
2+
3+
import lombok.ToString;
4+
import lombok.Value;
5+
import lombok.experimental.NonFinal;
6+
7+
import com.google.gson.annotations.SerializedName;
8+
9+
@Value
10+
@ToString(callSuper = true)
11+
@NonFinal
12+
public class User extends CreatubblesObject {
13+
14+
String age;
15+
@SerializedName("birth_month")
16+
String birthMonth;
17+
@SerializedName("birth_year")
18+
String birthYear;
19+
20+
String username;
21+
@SerializedName("display_name")
22+
String displayName;
23+
String email, role;
24+
25+
@SerializedName("country_code")
26+
String countryCode;
27+
@SerializedName("country_name")
28+
String countryName;
29+
30+
@SerializedName("created_at")
31+
String createdDate;
32+
@SerializedName("short_url")
33+
String shortUrl;
34+
@SerializedName("avatar_url")
35+
String avatarUrl;
36+
37+
String gender, interests;
38+
}

0 commit comments

Comments
 (0)