History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg/java/nio/file/StandardWatchEventKinds.java (1 of 18352 files). Show all

Unified · Split

java/pkg/java/nio/file/StandardWatchEventKinds.java+94−0
@@ -0,0 +1,94 @@
1+/*
2+ * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
3+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+ *
5+ * This code is free software; you can redistribute it and/or modify it
6+ * under the terms of the GNU General Public License version 2 only, as
7+ * published by the Free Software Foundation. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package java.nio.file;
27+
28+/**
29+ * Defines the <em>standard</em> event kinds.
30+ *
31+ * @since 1.7
32+ */
33+
34+public final class StandardWatchEventKinds {
35+ private StandardWatchEventKinds() { }
36+
37+ /**
38+ * A special event to indicate that events may have been lost or
39+ * discarded.
40+ *
41+ * <p> The {@link WatchEvent#context context} for this event is
42+ * implementation specific and may be {@code null}. The event {@link
43+ * WatchEvent#count count} may be greater than {@code 1}.
44+ *
45+ * @see WatchService
46+ */
47+ public static final WatchEvent.Kind<Object> OVERFLOW =
48+ new StdWatchEventKind<Object>("OVERFLOW", Object.class);
49+
50+ /**
51+ * Directory entry created.
52+ *
53+ * <p> When a directory is registered for this event then the {@link WatchKey}
54+ * is queued when it is observed that an entry is created in the directory
55+ * or renamed into the directory. The event {@link WatchEvent#count count}
56+ * for this event is always {@code 1}.
57+ */
58+ public static final WatchEvent.Kind<Path> ENTRY_CREATE =
59+ new StdWatchEventKind<Path>("ENTRY_CREATE", Path.class);
60+
61+ /**
62+ * Directory entry deleted.
63+ *
64+ * <p> When a directory is registered for this event then the {@link WatchKey}
65+ * is queued when it is observed that an entry is deleted or renamed out of
66+ * the directory. The event {@link WatchEvent#count count} for this event
67+ * is always {@code 1}.
68+ */
69+ public static final WatchEvent.Kind<Path> ENTRY_DELETE =
70+ new StdWatchEventKind<Path>("ENTRY_DELETE", Path.class);
71+
72+ /**
73+ * Directory entry modified.
74+ *
75+ * <p> When a directory is registered for this event then the {@link WatchKey}
76+ * is queued when it is observed that an entry in the directory has been
77+ * modified. The event {@link WatchEvent#count count} for this event is
78+ * {@code 1} or greater.
79+ */
80+ public static final WatchEvent.Kind<Path> ENTRY_MODIFY =
81+ new StdWatchEventKind<Path>("ENTRY_MODIFY", Path.class);
82+
83+ private static class StdWatchEventKind<T> implements WatchEvent.Kind<T> {
84+ private final String name;
85+ private final Class<T> type;
86+ StdWatchEventKind(String name, Class<T> type) {
87+ this.name = name;
88+ this.type = type;
89+ }
90+ @Override public String name() { return name; }
91+ @Override public Class<T> type() { return type; }
92+ @Override public String toString() { return name; }
93+ }
94+}