893N/A/*
3909N/A * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
893N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
893N/A *
893N/A * This code is free software; you can redistribute it and/or modify it
893N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
893N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
893N/A *
893N/A * This code is distributed in the hope that it will be useful, but WITHOUT
893N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
893N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
893N/A * version 2 for more details (a copy is included in the LICENSE file that
893N/A * accompanied this code).
893N/A *
893N/A * You should have received a copy of the GNU General Public License version
893N/A * 2 along with this work; if not, write to the Free Software Foundation,
893N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
893N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
893N/A */
893N/A
893N/Apackage java.nio.file;
893N/A
893N/A/**
893N/A * An event or a repeated event for an object that is registered with a {@link
893N/A * WatchService}.
893N/A *
893N/A * <p> An event is classified by its {@link #kind() kind} and has a {@link
893N/A * #count() count} to indicate the number of times that the event has been
893N/A * observed. This allows for efficient representation of repeated events. The
893N/A * {@link #context() context} method returns any context associated with
893N/A * the event. In the case of a repeated event then the context is the same for
893N/A * all events.
893N/A *
893N/A * <p> Watch events are immutable and safe for use by multiple concurrent
893N/A * threads.
893N/A *
893N/A * @param <T> The type of the context object associated with the event
893N/A *
893N/A * @since 1.7
893N/A */
893N/A
3471N/Apublic interface WatchEvent<T> {
893N/A
893N/A /**
893N/A * An event kind, for the purposes of identification.
893N/A *
893N/A * @since 1.7
4216N/A * @see StandardWatchEventKinds
893N/A */
893N/A public static interface Kind<T> {
893N/A /**
893N/A * Returns the name of the event kind.
893N/A */
893N/A String name();
893N/A
893N/A /**
893N/A * Returns the type of the {@link WatchEvent#context context} value.
893N/A */
893N/A Class<T> type();
893N/A }
893N/A
893N/A /**
893N/A * An event modifier that qualifies how a {@link Watchable} is registered
893N/A * with a {@link WatchService}.
893N/A *
893N/A * <p> This release does not define any <em>standard</em> modifiers.
893N/A *
893N/A * @since 1.7
893N/A * @see Watchable#register
893N/A */
893N/A public static interface Modifier {
893N/A /**
893N/A * Returns the name of the modifier.
893N/A */
893N/A String name();
893N/A }
893N/A
893N/A /**
893N/A * Returns the event kind.
893N/A *
908N/A * @return the event kind
893N/A */
3471N/A Kind<T> kind();
893N/A
893N/A /**
893N/A * Returns the event count. If the event count is greater than {@code 1}
893N/A * then this is a repeated event.
893N/A *
908N/A * @return the event count
893N/A */
3471N/A int count();
893N/A
893N/A /**
893N/A * Returns the context for the event.
893N/A *
4216N/A * <p> In the case of {@link StandardWatchEventKinds#ENTRY_CREATE ENTRY_CREATE},
4216N/A * {@link StandardWatchEventKinds#ENTRY_DELETE ENTRY_DELETE}, and {@link
4216N/A * StandardWatchEventKinds#ENTRY_MODIFY ENTRY_MODIFY} events the context is
893N/A * a {@code Path} that is the {@link Path#relativize relative} path between
893N/A * the directory registered with the watch service, and the entry that is
893N/A * created, deleted, or modified.
893N/A *
908N/A * @return the event context; may be {@code null}
893N/A */
3471N/A T context();
893N/A}