org.jbehave.core.io
Class StoryFinder

java.lang.Object
  extended by org.jbehave.core.io.StoryFinder

public class StoryFinder
extends Object

Finds stories by scanning file system. Stories can be either in the form of embeddable class names or story paths.


Constructor Summary
StoryFinder()
           
StoryFinder(Comparator<? super String> sortingComparator)
           
StoryFinder(String classNameExtension)
           
 
Method Summary
protected  String classNameExtension()
           
protected  List<String> classNames(List<String> paths)
           
 List<String> findClassNames(String searchInDirectory, List<String> includes, List<String> excludes)
          Finds java source paths from a base directory, allowing for includes/excludes, and converts them to class names.
 List<String> findPaths(String searchInDirectory, List<String> includes, List<String> excludes)
          Finds paths from a base directory, allowing for includes/excludes.
 List<String> findPaths(String searchInDirectory, List<String> includes, List<String> excludes, String prefixWith)
          Finds paths from a base directory, allowing for includes/excludes.
 List<String> findPaths(URL searchInURL, String include, String exclude)
          Finds paths from a base URL, allowing for single include/exclude pattern.
protected  List<String> normalise(List<String> paths)
           
protected  List<String> prefix(String prefixWith, List<String> paths)
           
protected  List<String> scan(String basedir, List<String> includes, List<String> excludes)
           
protected  List<String> sort(List<String> input)
           
protected  Comparator<? super String> sortingComparator()
          Comparator used for sorting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StoryFinder

public StoryFinder()

StoryFinder

public StoryFinder(String classNameExtension)

StoryFinder

public StoryFinder(Comparator<? super String> sortingComparator)
Method Detail

findClassNames

public List<String> findClassNames(String searchInDirectory,
                                   List<String> includes,
                                   List<String> excludes)
Finds java source paths from a base directory, allowing for includes/excludes, and converts them to class names.

Parameters:
searchInDirectory - the base directory path to search in
includes - the List of include patterns, or null if none
excludes - the List of exclude patterns, or null if none
Returns:
A List of class names found

findPaths

public List<String> findPaths(URL searchInURL,
                              String include,
                              String exclude)
Finds paths from a base URL, allowing for single include/exclude pattern. Paths found are normalised by StoryFinder#normalise(List).

Parameters:
searchInURL - the base URL to search in
include - the include pattern, or "" if none
exclude - the exclude pattern, or "" if none
Returns:
A List of paths found

findPaths

public List<String> findPaths(String searchInDirectory,
                              List<String> includes,
                              List<String> excludes)
Finds paths from a base directory, allowing for includes/excludes. Paths found are normalised by StoryFinder#normalise(List).

Parameters:
searchInDirectory - the base directory path to search in
includes - the List of include patterns, or null if none
excludes - the List of exclude patterns, or null if none
Returns:
A List of paths found

findPaths

public List<String> findPaths(String searchInDirectory,
                              List<String> includes,
                              List<String> excludes,
                              String prefixWith)
Finds paths from a base directory, allowing for includes/excludes. Paths found are prefixed with specified path by StoryFinder#prefix(String, List) and normalised by StoryFinder#normalise(List).

Parameters:
searchInDirectory - the base directory path to search in
includes - the List of include patterns, or null if none
excludes - the List of exclude patterns, or null if none
prefixWith - the root path prefixed to all paths found, or null if none
Returns:
A List of paths found

normalise

protected List<String> normalise(List<String> paths)

prefix

protected List<String> prefix(String prefixWith,
                              List<String> paths)

classNames

protected List<String> classNames(List<String> paths)

classNameExtension

protected String classNameExtension()

sort

protected List<String> sort(List<String> input)

sortingComparator

protected Comparator<? super String> sortingComparator()
Comparator used for sorting. A null comparator means that Collections#sort() will use natural ordering.

Returns:
A Comparator or null for natural ordering.

scan

protected List<String> scan(String basedir,
                            List<String> includes,
                            List<String> excludes)


Copyright © 2003-2011. All Rights Reserved.