T
- The type of the context object associated with the eventpublic interface WatchEvent<T>
WatchService
. An event is classified by its kind
and has a count
to indicate the number of times that the event has been observed. This allows for efficient representation of repeated events. The context
method returns any context associated with the event. In the case of a repeated event then the context is the same for all events.
Watch events are immutable and safe for use by multiple concurrent threads.
Modifier and Type | Interface | Description |
---|---|---|
static interface |
WatchEvent.Kind<T> |
An event kind, for the purposes of identification. |
static interface |
WatchEvent.Modifier |
An event modifier that qualifies how a Watchable is registered with a WatchService . |
WatchEvent.Kind<T> kind()
int count()
1
then this is a repeated event.T context()
In the case of ENTRY_CREATE
, ENTRY_DELETE
, and ENTRY_MODIFY
events the context is a Path
that is the relative
path between the directory registered with the watch service, and the entry that is created, deleted, or modified.
null
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/nio/file/WatchEvent.html