Package io.vertx.config.spi.utils
Class FileSet
- java.lang.Object
-
- io.vertx.config.spi.utils.FileSet
-
public class FileSet extends Object
Utility class to manage file set selected using a pattern.- Author:
- Clement Escoffier
-
-
Constructor Summary
Constructors Constructor Description FileSet(Vertx vertx, File root, JsonObject set)
Creates a newFileSet
from a json object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.static boolean
match(String pattern, String str, boolean isCaseSensitive)
Tests whether or not a string matches against a pattern.static List<File>
traverse(File root)
List all the files from a directory (recursive)
-
-
-
Constructor Detail
-
FileSet
public FileSet(Vertx vertx, File root, JsonObject set)
Creates a newFileSet
from a json object.- Parameters:
vertx
- the Vert.x instanceroot
- 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, orfalse
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 fileshandler
- the handler called with the computed configuration
-
-