Class FileMonitor.Builder<B extends FileMonitor.Builder<B>>
- Type Parameters:
B
- the type of the Builder that is returned
- All Implemented Interfaces:
BuilderInterface
- Enclosing class:
FileMonitor
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Finish building theFileMonitor
object.onChanged
(FileMonitor.ChangedCallback handler) Emitted whenfile
has been changed.setRateLimit
(int rateLimit) The limit of the monitor to watch for changes, in milliseconds.Methods inherited from class org.gnome.gobject.GObject.Builder
onNotify
Methods inherited from class io.github.jwharm.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilder
object.
-
-
Method Details
-
build
Finish building theFileMonitor
object. This will callGObject.withProperties(org.gnome.glib.Type, java.lang.String[], org.gnome.gobject.Value[])
to create a new GObject instance, which is then cast toFileMonitor
.- Overrides:
build
in classGObject.Builder<B extends FileMonitor.Builder<B>>
- Returns:
- a new instance of
FileMonitor
with the properties that were set in the Builder object.
-
setRateLimit
The limit of the monitor to watch for changes, in milliseconds.- Parameters:
rateLimit
- the value for therate-limit
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
onChanged
Emitted whenfile
has been changed.If using
FileMonitorFlags.WATCH_MOVES
on a directory monitor, and the information is available (and if supported by the backend),eventType
may beFileMonitorEvent.RENAMED
,FileMonitorEvent.MOVED_IN
orFileMonitorEvent.MOVED_OUT
.In all cases
file
will be a child of the monitored directory. For renames,file
will be the old name andotherFile
is the new name. For "moved in" events,file
is the name of the file that appeared andotherFile
is the old name that it was moved from (in another directory). For "moved out" events,file
is the name of the file that used to be in this directory andotherFile
is the name of the file at its new location.It makes sense to treat
FileMonitorEvent.MOVED_IN
as equivalent toFileMonitorEvent.CREATED
andFileMonitorEvent.MOVED_OUT
as equivalent toFileMonitorEvent.DELETED
, with extra information.FileMonitorEvent.RENAMED
is equivalent to a delete/create pair. This is exactly how the events will be reported in the case that theFileMonitorFlags.WATCH_MOVES
flag is not in use.If using the deprecated flag
FileMonitorFlags.SEND_MOVED
flag andeventType
isFileMonitorEvent.MOVED
,file
will be set to aGFile
containing the old path, andotherFile
will be set to aGFile
containing the new path.In all the other cases,
otherFile
will be set toNULL
.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-