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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Finish building theFileMonitorobject.onChanged(FileMonitor.ChangedCallback handler) Emitted whenfilehas 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
onNotifyMethods inherited from class org.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilderobject.
-
-
Method Details
-
build
Finish building theFileMonitorobject. 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:
buildin classGObject.Builder<B extends FileMonitor.Builder<B>>- Returns:
- a new instance of
FileMonitorwith 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-limitproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
onChanged
Emitted whenfilehas been changed.If using
FileMonitorFlags.WATCH_MOVESon a directory monitor, and the information is available (and if supported by the backend),eventTypemay beFileMonitorEvent.RENAMED,FileMonitorEvent.MOVED_INorFileMonitorEvent.MOVED_OUT.In all cases
filewill be a child of the monitored directory. For renames,filewill be the old name andotherFileis the new name. For "moved in" events,fileis the name of the file that appeared andotherFileis the old name that it was moved from (in another directory). For "moved out" events,fileis the name of the file that used to be in this directory andotherFileis the name of the file at its new location.It makes sense to treat
FileMonitorEvent.MOVED_INas equivalent toFileMonitorEvent.CREATEDandFileMonitorEvent.MOVED_OUTas equivalent toFileMonitorEvent.DELETED, with extra information.FileMonitorEvent.RENAMEDis equivalent to a delete/create pair. This is exactly how the events will be reported in the case that theFileMonitorFlags.WATCH_MOVESflag is not in use.If using the deprecated flag
FileMonitorFlags.SEND_MOVEDflag andeventTypeisFileMonitorEvent.MOVED,filewill be set to aGFilecontaining the old path, andotherFilewill be set to aGFilecontaining the new path.In all the other cases,
otherFilewill be set toNULL.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-