Skip to content

Commit cc8fa90

Browse files
author
Zoltan Molnar
committed
[RF2] Remove date and time calculation from construction time
Signed-off-by: Zoltan Molnar <zmolnar@b2international.com>
1 parent c59a00e commit cc8fa90

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/main/java/com/b2international/rf2/spec/RF2ReleaseSpecification.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
*/
3030
public final class RF2ReleaseSpecification {
3131

32-
private final String initial;
32+
33+
private final String initial;
3334
private final String product;
3435
private final String format;
3536
private final String status;
@@ -39,6 +40,7 @@ public final class RF2ReleaseSpecification {
3940
private final String time;
4041
private final String[] contentSubTypes;
4142
private final RF2ReleaseContent content;
43+
private final LocalDateTime now = LocalDateTime.now(ZoneId.of("UTC"));
4244

4345
@JsonCreator
4446
public RF2ReleaseSpecification(
@@ -58,9 +60,8 @@ public RF2ReleaseSpecification(
5860
this.status = status;
5961
this.country = country;
6062
this.namespace = namespace;
61-
final LocalDateTime now = LocalDateTime.now(ZoneId.of("UTC"));
62-
this.date = Strings.isNullOrEmpty(date) ? now.format(DateTimeFormatter.BASIC_ISO_DATE) : date;
63-
this.time = Strings.isNullOrEmpty(time) ? now.format(DateTimeFormatter.ofPattern("HHmmss")) : time;
63+
this.date = date;
64+
this.time = time;
6465
this.contentSubTypes = contentSubTypes;
6566
this.content = content;
6667
}
@@ -90,11 +91,11 @@ public String getNamespace() {
9091
}
9192

9293
public String getDate() {
93-
return date;
94+
return Strings.isNullOrEmpty(date) ? now.format(DateTimeFormatter.BASIC_ISO_DATE) : date;
9495
}
9596

9697
public String getTime() {
97-
return time;
98+
return Strings.isNullOrEmpty(time) ? now.format(DateTimeFormatter.ofPattern("HHmmss")) : time;
9899
}
99100

100101
@JsonProperty("contentSubType")

0 commit comments

Comments
 (0)