Class FileSet


  • public class FileSet
    extends Object
    Utility class to manage file set selected using a pattern.
    Author:
    Clement Escoffier
    • Constructor Detail

      • FileSet

        public FileSet​(Vertx vertx,
                       File root,
                       JsonObject set)
        Creates a new FileSet from a json object.
        Parameters:
        vertx - the Vert.x instance
        root - the root of the fileset (directory)
        set - the configuration
    • Method Detail

      • match

        public static boolean match​(String pattern,
                                    String str,
                                    boolean isCaseSensitive)
        Tests whether or not a string matches against a pattern. The pattern may contain two special characters:
        '*' means zero or more characters
        '?' means one and only one character
        Parameters:
        pattern - The pattern to match against. Must not benull.
        str - The string which must be matched against the pattern. Must not benull.
        isCaseSensitive - Whether or not matching should be performed case sensitively.
        Returns:
        true if the string matches against the pattern, or false otherwise.
      • buildConfiguration

        public void buildConfiguration​(List<File> files,
                                       Handler<AsyncResult<JsonObject>> handler)
        Iterates over the given set of files, and for each matching file, computes the resulting configuration. The given handler is called with the merged configuration (containing the configuration obtained by merging the configuration from all matching files).
        Parameters:
        files - the list of files
        handler - the handler called with the computed configuration
      • traverse

        public static List<File> traverse​(File root)
        List all the files from a directory (recursive)
        Parameters:
        root - the root
        Returns:
        the list of files