Packages

sealed trait Glob extends AnyRef

Represents a query for a path on the file system. Instances of Glob can be combined together to build a more complicated query. Similar to the path name components of a Path, a Glob has components and matching is done from left to right component-wise. Each component is matched using a PathMatcher. For example,

val baseGlob = Glob("/foo/bar")
baseGlob.matches(Paths.get("/foo/bar")) // true
baseGlob.matches(Paths.get("/foo")) // false
baseGlob.matches(Paths.get("/foo/bar/baz")) // false

val children = baseGlob / AnyPath
children.matches(Paths.get("/foo/bar")) // false
children.matches(Paths.get("/foo/bar/baz")) // true
children.matches(Paths.get("/foo/bar/baz/buzz")) false

val secondGenerationChildren = children / AnyPath
secondGeneration.matches(Paths.get("/foo/bar/baz")) // false
secondGeneration.matches(Paths.get("/foo/bar/baz/buzz")) // true
secondGeneration.matches(Paths.get("/foo/bar/baz/buzz/fizz")) // false

where AnyPath matches any path name.

Globs can be recursive and are constructed using the RecursiveGlob:

val baseGlob = Glob("/foo/bar")
val allDescendants = baseGlob / RecursiveGlob
allDescendants.matches(Paths.get("/foo/bar")) // false
allDescendants.matches(Paths.get("/foo/bar/baz/buzz.txt")) // true

They can also filter on the basis file names:

val baseGlob = Glob("/foo/bar")
val allScalaSources = baseGlob / RecursiveGlob / "*.scala"
allScalaSources.matches(Paths.get("/foo/bar/Foo.scala")) // true
allScalaSources.matches(Paths.get("/foo/bar/baz/fizz/buzz/Bar.scala")) // true
allScalaSources.matches(Paths.get("/foo/bar/baz/fizz/buzz/Buzz.java")) // false

val allScalaAndJavaSources = baseGlob / RecursiveGlob / "*.{java,scala}"
allScalaAndJavaSources.matches(Paths.get("/foo/bar/baz/fizz/buzz/Bar.scala")) // true
allScalaAndJavaSources.matches(Paths.get("/foo/bar/baz/fizz/buzz/Buzz.java")) // true
Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Glob
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def matches(path: Path): Boolean

    Indicates whether a path matches the pattern specified by this Glob.

    Indicates whether a path matches the pattern specified by this Glob.

    path

    the path to match

    returns

    true it the path matches.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  16. def toString(): String
    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped