Search in sources :

Example 1 with MountPredicate

use of com.github.dreamhead.moco.mount.MountPredicate in project moco by dreamhead.

the class MocoMount method include.

public static MountPredicate include(final String glob) {
    checkNotNullOrEmpty(glob, "Glob should not be null or empty");
    final PathMatcher matcher = FileSystems.getDefault().getPathMatcher("glob:" + glob);
    return filename -> matcher.matches(Paths.get(filename));
}
Also used : Paths(java.nio.file.Paths) PathMatcher(java.nio.file.PathMatcher) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) MountTo(com.github.dreamhead.moco.mount.MountTo) MountPredicate(com.github.dreamhead.moco.mount.MountPredicate) FileSystems(java.nio.file.FileSystems) Preconditions.checkNotNullOrEmpty(com.github.dreamhead.moco.util.Preconditions.checkNotNullOrEmpty) PathMatcher(java.nio.file.PathMatcher)

Aggregations

MountPredicate (com.github.dreamhead.moco.mount.MountPredicate)1 MountTo (com.github.dreamhead.moco.mount.MountTo)1 Preconditions.checkNotNullOrEmpty (com.github.dreamhead.moco.util.Preconditions.checkNotNullOrEmpty)1 Preconditions.checkNotNull (com.google.common.base.Preconditions.checkNotNull)1 FileSystems (java.nio.file.FileSystems)1 PathMatcher (java.nio.file.PathMatcher)1 Paths (java.nio.file.Paths)1