File tree Expand file tree Collapse file tree 3 files changed +49
-4
lines changed
src/main/java/xyz/srnyx/lazylibrary Expand file tree Collapse file tree 3 files changed +49
-4
lines changed Original file line number Diff line number Diff 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 ) {
Original file line number Diff line number Diff line change 1010import 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+ */
1417public 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}
Original file line number Diff line number Diff line change 55import 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+ */
914public 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
You can’t perform that action at this time.
0 commit comments