Skip to content

Commit c1b6e24

Browse files
committed
Add missing Javadocs
1 parent 918186c commit c1b6e24

File tree

3 files changed

+49
-4
lines changed

3 files changed

+49
-4
lines changed

src/main/java/xyz/srnyx/lazylibrary/LazyEmoji.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ public enum LazyEmoji {
286286
*/
287287
QUESTION_CLEAR_DARK(1298411642358337578L);
288288

289+
/**
290+
* The {@link CustomEmoji} for this {@link LazyEmoji}
291+
*/
289292
@NotNull public final CustomEmoji emoji;
290293

291294
LazyEmoji(long id, boolean animated) {

src/main/java/xyz/srnyx/lazylibrary/logging/FixedWindowWithTimeRollingPolicy.java

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,45 @@
1010
import java.util.regex.Pattern;
1111

1212

13-
// https://stackoverflow.com/a/72377192/18122334
13+
/**
14+
* A {@link FixedWindowRollingPolicy} that replaces {@code %d{FORMAT}} with {@link DateTimeFormatter#ofPattern(String)}
15+
* <br>Based on <a href="https://stackoverflow.com/a/72377192/18122334">a StackOverflow answer</a>
16+
*/
1417
public class FixedWindowWithTimeRollingPolicy extends FixedWindowRollingPolicy {
15-
@NotNull private static final ZoneId ZONE_ID = ZoneId.of("America/New_York");
1618
@NotNull private static final Pattern DATE_PATTERN = Pattern.compile("%d\\{([^}]+)}");
1719

20+
String zoneId;
21+
22+
/**
23+
* Constructs a new {@link FixedWindowWithTimeRollingPolicy} with the default options
24+
*/
25+
public FixedWindowWithTimeRollingPolicy() {
26+
super();
27+
zoneId = "US/Eastern";
28+
}
29+
1830
@Override
1931
public void setFileNamePattern(String fnp) {
2032
// Replace %d{FORMAT} with DateTimeFormatter.ofPattern(FORMAT)
21-
final OffsetDateTime now = OffsetDateTime.now(ZONE_ID);
33+
final OffsetDateTime now = OffsetDateTime.now(ZoneId.of(zoneId));
2234
super.setFileNamePattern(DATE_PATTERN.matcher(fnp).replaceAll(m -> DateTimeFormatter.ofPattern(m.group(1)).format(now)));
2335
}
36+
37+
/**
38+
* Sets the {@link ZoneId} to use when formatting the date
39+
*
40+
* @param zoneId the {@link ZoneId} to use when formatting the date
41+
*/
42+
public void setZoneId(String zoneId) {
43+
this.zoneId = zoneId;
44+
}
45+
46+
/**
47+
* Gets the {@link ZoneId} to use when formatting the date
48+
*
49+
* @return the {@link ZoneId} to use when formatting the date
50+
*/
51+
public String getZoneId() {
52+
return zoneId;
53+
}
2454
}

src/main/java/xyz/srnyx/lazylibrary/logging/StartupBasedTriggeringPolicy.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,22 @@
55
import java.io.File;
66

77

8-
// https://stackoverflow.com/a/32203808/18122334
8+
/**
9+
* A {@link TriggeringPolicyBase} that rolls the file on startup
10+
* <br>Based on <a href="https://stackoverflow.com/a/32203808/18122334">a StackOverflow answer</a>
11+
*
12+
* @param <T> the type of the event
13+
*/
914
public class StartupBasedTriggeringPolicy<T> extends TriggeringPolicyBase<T> {
1015
private boolean doRolling = true;
1116

17+
/**
18+
* Constructs a new {@link StartupBasedTriggeringPolicy} with the default options
19+
*/
20+
public StartupBasedTriggeringPolicy() {
21+
super();
22+
}
23+
1224
@Override
1325
public boolean isTriggeringEvent(File activeFile, T event) {
1426
// Roll first time when event gets called

0 commit comments

Comments
 (0)