Class FileWatchConfiguration

  • All Implemented Interfaces:
    io.micronaut.core.util.Toggleable

    @ConfigurationProperties("micronaut.io.watch")
    @Requires(property="micronaut.io.watch.paths")
    public class FileWatchConfiguration
    extends java.lang.Object
    implements io.micronaut.core.util.Toggleable
    Configuration for the file watch service.
    Since:
    1.1.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ENABLED
      Setting to enable and disable server watch.
      static java.lang.String PATHS
      The watch paths.
      static java.lang.String PREFIX
      The prefix to use to configure the watch service.
      static java.lang.String RESTART
      Setting to enable and disable restart.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.time.Duration getCheckInterval()
      The interval to wait between checks.
      java.util.List<java.nio.file.Path> getPaths()
      The paths to watch.
      boolean isEnabled()  
      boolean isRestart()
      Should the server be shutdown when a watch event fires.
      void setCheckInterval​(java.time.Duration checkInterval)
      Sets the interval to wait between file watch polls.
      void setEnabled​(boolean enabled)
      Whether watch is enabled.
      void setPaths​(java.util.List<java.nio.file.Path> paths)
      Sets the watch paths to use.
      void setRestart​(boolean restart)
      Set whether restart is enabled.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PREFIX

        public static final java.lang.String PREFIX
        The prefix to use to configure the watch service.
        See Also:
        Constant Field Values
      • ENABLED

        public static final java.lang.String ENABLED
        Setting to enable and disable server watch.
        See Also:
        Constant Field Values
      • RESTART

        public static final java.lang.String RESTART
        Setting to enable and disable restart.
        See Also:
        Constant Field Values
    • Constructor Detail

      • FileWatchConfiguration

        public FileWatchConfiguration()
    • Method Detail

      • isEnabled

        public boolean isEnabled()
        Specified by:
        isEnabled in interface io.micronaut.core.util.Toggleable
      • isRestart

        public boolean isRestart()
        Should the server be shutdown when a watch event fires. Note that if set to true an external process like gradle run --continuous or Kubernetes replication controller is required to restart the container.
        Returns:
        Is restart enabled. Defaults to false.
      • setRestart

        public void setRestart​(boolean restart)
        Set whether restart is enabled.
        Parameters:
        restart - True if restart is to be enabled
        See Also:
        isRestart()
      • setEnabled

        public void setEnabled​(boolean enabled)
        Whether watch is enabled.
        Parameters:
        enabled - True if is enabled
      • getPaths

        public java.util.List<java.nio.file.Path> getPaths()
        The paths to watch.
        Returns:
        A lists of Path objects
      • setPaths

        public void setPaths​(@NonNull
                             java.util.List<java.nio.file.Path> paths)
        Sets the watch paths to use.
        Parameters:
        paths - The watch paths
      • getCheckInterval

        @NonNull
        public java.time.Duration getCheckInterval()
        The interval to wait between checks.
        Returns:
        The interval to wait.
      • setCheckInterval

        public void setCheckInterval​(@NonNull
                                     java.time.Duration checkInterval)
        Sets the interval to wait between file watch polls.
        Parameters:
        checkInterval - The check interval