com.teamdev.filewatch
Class FileEvent

java.lang.Object
  extended by java.util.EventObject
      extended by com.teamdev.filewatch.FileEvent
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
FileEvent.Added, FileEvent.Changed, FileEvent.Deleted, FileEvent.Renamed

public abstract class FileEvent
extends java.util.EventObject

Class that represents a file system event.

See Also:
Serialized Form

Nested Class Summary
static class FileEvent.Added
          The event for a new file.
static class FileEvent.Changed
          The event for a changed file.
static class FileEvent.Deleted
          The event for a deleted file.
static class FileEvent.Moved
           Artificial event that represents add-delete event pair for the file reallocated from one folder to another.
static class FileEvent.Renamed
          The event for a renamed file.
 
Field Summary
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
FileEvent(FileWatcher source, java.io.File file)
          Constructs a new event ocurred to the file
 
Method Summary
protected abstract  void dispatch(FileEventsListener listener)
          Implementing events should call an appropriate method of the listener passing itself as a parameter of the corresponding listener's method.
 long getEventId()
          Returns event id of this event if supported by filesystem
 java.io.File getFile()
          Returns file of this event.
protected  java.lang.String getNativeKind()
           
 void setEventId(long eventId)
           
 java.lang.String toString()
           
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileEvent

public FileEvent(FileWatcher source,
                 java.io.File file)
Constructs a new event ocurred to the file

Parameters:
source - the watcher object that originated the event
file - the file for which the event ocurred. Never null.
Method Detail

getFile

public java.io.File getFile()
Returns file of this event.

Returns:
file

getEventId

public long getEventId()
Returns event id of this event if supported by filesystem

Returns:
file

setEventId

public void setEventId(long eventId)

toString

public java.lang.String toString()
Overrides:
toString in class java.util.EventObject

getNativeKind

protected java.lang.String getNativeKind()

dispatch

protected abstract void dispatch(FileEventsListener listener)
Implementing events should call an appropriate method of the listener passing itself as a parameter of the corresponding listener's method.

Parameters:
listener - a listener to notify.