Spec-Zone .ru
спецификации, руководства, описания, API
Please note that the specifications and other information contained herein are not final and are subject to change. The information is being made available to you solely for purpose of evaluation.

Java™ Platform
Standard Ed. 7

DRAFT ea-b118

java.nio.file
Class WatchEvent<T>

java.lang.Object
  extended by java.nio.file.WatchEvent<T>
Type Parameters:
T - The type of the context object associated with the event

public abstract class WatchEvent<T>
extends Object

An event or a repeated event for an object that is registered with a 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.

Since:
1.7

Nested Class Summary
Modifier and Type Class and 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.
 
Constructor Summary
Modifier Constructor and Description
protected WatchEvent()
          Initializes a new instance of this class.
 
Method Summary
Modifier and Type Method and Description
abstract  T context()
          Returns the context for the event.
abstract  int count()
          Returns the event count.
abstract  WatchEvent.Kind<T> kind()
          Returns the event kind.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WatchEvent

protected WatchEvent()
Initializes a new instance of this class.

Method Detail

kind

public abstract WatchEvent.Kind<T> kind()
Returns the event kind.

Returns:
the event kind

count

public abstract int count()
Returns the event count. If the event count is greater than 1 then this is a repeated event.

Returns:
the event count

context

public abstract T context()
Returns the context for the event.

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.

Returns:
the event context; may be null

Java™ Platform
Standard Ed. 7

DRAFT ea-b118

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Copyright © 1993, 2010, Oracle Corporation. All rights reserved.
DRAFT ea-b118

Scripting on this page tracks web page traffic, but does not change the content in any way.