Skip to content

Commit 569eea5

Browse files
committed
Fixed javadoc omissions
1 parent fbea633 commit 569eea5

File tree

6 files changed

+44
-3
lines changed

6 files changed

+44
-3
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,5 @@ jobs:
7272

7373
- run: mvn -B editorconfig:check
7474

75+
- run: mvn -B -Dmaven.javadoc.failOnWarnings javadoc:jar -Prelease
76+

pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@
281281
</goals>
282282
</execution>
283283
</executions>
284+
<configuration>
285+
<excludePackageNames>engineering.swat.watch.impl:engineering.swat.watch.impl.*</excludePackageNames>
286+
</configuration>
284287
</plugin>
285288
<plugin> <!-- generate sources jar -->
286289
<groupId>org.apache.maven.plugins</groupId>

src/main/java/engineering/swat/watch/ActiveWatch.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@
3737
public interface ActiveWatch extends Closeable {
3838

3939
/**
40-
* Gets the path watched by this watch.
40+
* @return the path watched by this watch.
4141
*/
4242
Path getPath();
4343

4444
/**
45-
* Gets the scope of this watch.
45+
* @return the scope of this watch.
4646
*/
4747
WatchScope getScope();
4848
}

src/main/java/engineering/swat/watch/Watch.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ private Watch(Path path, WatchScope scope) {
7575
* @param path which absolute path to monitor, can be a file or a directory, but has to be absolute
7676
* @param scope for directories you can also choose to monitor it's direct children or all it's descendants
7777
* @throws IllegalArgumentException in case a path is not supported (in relation to the scope)
78+
* @return watch builder that can be further configured and then started
7879
*/
7980
public static Watch build(Path path, WatchScope scope) {
8081
if (!path.isAbsolute()) {
@@ -103,7 +104,7 @@ public static Watch build(Path path, WatchScope scope) {
103104
* Use the {@link #withExecutor(Executor)} function to influence the sequencing of these events.
104105
* By default they can arrive in parallel.
105106
* @param eventHandler a callback that handles the watch event, will be called once per event.
106-
* @return this for optional method chaining
107+
* @return {@code this} (to support method chaining)
107108
*/
108109
public Watch on(Consumer<WatchEvent> eventHandler) {
109110
if (this.eventHandler != EMPTY_HANDLER) {
@@ -115,6 +116,8 @@ public Watch on(Consumer<WatchEvent> eventHandler) {
115116

116117
/**
117118
* Convenience variant of {@link #on(Consumer)}, which allows you to only respond to certain events
119+
* @param listener gets executed on every event the watch produced
120+
* @return {@code this} (to support method chaining)
118121
*/
119122
public Watch on(WatchEventListener listener) {
120123
if (this.eventHandler != EMPTY_HANDLER) {

src/main/java/engineering/swat/watch/WatchEvent.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,30 @@ public enum Kind {
7171

7272
private static final Path EMPTY_PATH = Path.of("");
7373

74+
/**
75+
* Internal constructor an end user should never call, creates a new watch event for the root of a watch
76+
* @param kind kind of watch event
77+
* @param rootPath the path of the registered watch
78+
*/
7479
public WatchEvent(Kind kind, Path rootPath) {
7580
this(kind, rootPath, null);
7681
}
7782

83+
/**
84+
* Internal constructor an end user should never call, creates a new watch event
85+
* @param kind kind of watch event
86+
* @param rootPath the path of the registered watch
87+
* @param relativePath the child path of the event
88+
*/
7889
public WatchEvent(Kind kind, Path rootPath, @Nullable Path relativePath) {
7990
this.kind = kind;
8091
this.rootPath = rootPath;
8192
this.relativePath = relativePath == null ? EMPTY_PATH : relativePath;
8293
}
8394

95+
/**
96+
* @return the kind of watch event
97+
*/
8498
public Kind getKind() {
8599
return this.kind;
86100
}
@@ -141,6 +155,9 @@ public String toString() {
141155
* of the same file result in events that are equivalent, but not equal;
142156
* they need to be distinguishable in collections).
143157
* </p>
158+
* @param e1 event 1
159+
* @param e2 event 2
160+
* @return true if e1 and e2 are the same path and kind
144161
*/
145162
public static boolean areEquivalent(WatchEvent e1, WatchEvent e2) {
146163
return Objects.equals(e1.getKind(), e2.getKind()) &&

src/main/java/engineering/swat/watch/WatchEventListener.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,24 @@
3030
* A visit like interface that allows you to only override the functions you are interested in
3131
*/
3232
public interface WatchEventListener {
33+
/**
34+
* executed in case of a create event
35+
* @param ev the event
36+
*/
3337
default void onCreated(WatchEvent ev) { }
38+
/**
39+
* executed in case of a modified event
40+
* @param ev the event
41+
*/
3442
default void onModified(WatchEvent ev) { }
43+
/**
44+
* executed in case of a delete event
45+
* @param ev the event
46+
*/
3547
default void onDeleted(WatchEvent ev) { }
48+
/**
49+
* executed in case of a overflow event
50+
* @param ev the event
51+
*/
3652
default void onOverflow(WatchEvent ev) { }
3753
}

0 commit comments

Comments
 (0)