1 package jdk.internal.unsupported;
   2 
   3 import sun.nio.fs.ExtendedOptions;
   4 
   5 import java.nio.file.CopyOption;
   6 import java.nio.file.OpenOption;
   7 import java.nio.file.WatchEvent;
   8 
   9 /**
  10  * Internal file system options for com.sun.nio.file package.
  11  */
  12 public final class FileSystemOption<T> {
  13     public static final FileSystemOption<Void> INTERRUPTIBLE =
  14         new FileSystemOption<>(ExtendedOptions.INTERRUPTIBLE);
  15     public static final FileSystemOption<Void> NOSHARE_READ =
  16         new FileSystemOption<>(ExtendedOptions.NOSHARE_READ);
  17     public static final FileSystemOption<Void> NOSHARE_WRITE =
  18         new FileSystemOption<>(ExtendedOptions.NOSHARE_WRITE);
  19     public static final FileSystemOption<Void> NOSHARE_DELETE =
  20         new FileSystemOption<>(ExtendedOptions.NOSHARE_DELETE);
  21     public static final FileSystemOption<Void> FILE_TREE =
  22         new FileSystemOption<>(ExtendedOptions.FILE_TREE);
  23     public static final FileSystemOption<Void> DIRECT =
  24         new FileSystemOption<>(ExtendedOptions.DIRECT);
  25     public static final FileSystemOption<Integer> SENSITIVITY_HIGH =
  26         new FileSystemOption<>(ExtendedOptions.SENSITIVITY_HIGH);
  27     public static final FileSystemOption<Integer> SENSITIVITY_MEDIUM =
  28         new FileSystemOption<>(ExtendedOptions.SENSITIVITY_MEDIUM);
  29     public static final FileSystemOption<Integer> SENSITIVITY_LOW =
  30         new FileSystemOption<>(ExtendedOptions.SENSITIVITY_LOW);
  31 
  32     private final ExtendedOptions.InternalOption<T> internalOption;
  33     private FileSystemOption(ExtendedOptions.InternalOption<T> option) {
  34         this.internalOption = option;
  35     }
  36 
  37     /**
  38      * Register this internal option as a OpenOption.
  39      */
  40     public void register(OpenOption option) {
  41         internalOption.register(option);
  42     }
  43 
  44     /**
  45      * Register this internal option as a CopyOption.
  46      */
  47     public void register(CopyOption option) {
  48         internalOption.register(option);
  49     }
  50 
  51     /**
  52      * Register this internal option as a WatchEvent.Modifier.
  53      */
  54     public void register(WatchEvent.Modifier option) {
  55         internalOption.register(option);
  56     }
  57 
  58     /**
  59      * Register this internal option as a WatchEvent.Modifier with the
  60      * given parameter.
  61      */
  62     public void register(WatchEvent.Modifier option, T param) {
  63         internalOption.register(option, param);
  64     }
  65 }