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 source paths, which can be either filesystem directories or jars. Jars are identified by paths ending in ".jar". Stories can be either in the form of class names or story paths. Stories can be sorted by providing a sorting comparator.


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 searchIn, List<String> includes, List<String> excludes)
          Finds Java classes from a source path, allowing for includes/excludes, and converts them to class names.
 List<String> findPaths(String searchIn, List<String> includes, List<String> excludes)
          Finds paths from a source path, allowing for includes/excludes.
 List<String> findPaths(String searchIn, List<String> includes, List<String> excludes, String prefixWith)
          Finds paths from a source path, allowing for includes/excludes.
 List<String> findPaths(String searchIn, String include, String exclude)
          Finds paths from a source path, allowing for single include/exclude pattern.
 List<String> findPaths(URL searchIn, List<String> includes, List<String> excludes)
          Finds paths from a source URL, allowing for includes/excludes, pattern.
 List<String> findPaths(URL searchIn, String include, String exclude)
          Finds paths from a source 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 source, List<String> includes, List<String> excludes)
           
protected  List<String> scanJar(String jarPath, 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 searchIn,
                                   List<String> includes,
                                   List<String> excludes)
Finds Java classes from a source path, allowing for includes/excludes, and converts them to class names.

Parameters:
searchIn - the 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 searchIn,
                              String include,
                              String exclude)
Finds paths from a source URL, allowing for single include/exclude pattern. Paths found are normalised by StoryFinder#normalise(List)

Parameters:
searchIn - the source 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(URL searchIn,
                              List<String> includes,
                              List<String> excludes)
Finds paths from a source URL, allowing for includes/excludes, pattern. Paths found are normalised by StoryFinder#normalise(List)

Parameters:
searchIn - the source URL 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 searchIn,
                              String include,
                              String exclude)
Finds paths from a source path, allowing for single include/exclude pattern. Paths found are normalised by StoryFinder#normalise(List)

Parameters:
searchIn - the source path 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 searchIn,
                              List<String> includes,
                              List<String> excludes)
Finds paths from a source path, allowing for includes/excludes. Paths found are normalised by StoryFinder#normalise(List).

Parameters:
searchIn - the source 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 searchIn,
                              List<String> includes,
                              List<String> excludes,
                              String prefixWith)
Finds paths from a source path, allowing for includes/excludes. Paths found are prefixed with specified path by StoryFinder#prefix(String, List) and normalised by StoryFinder#normalise(List).

Parameters:
searchIn - the source 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 source,
                            List<String> includes,
                            List<String> excludes)

scanJar

protected List<String> scanJar(String jarPath,
                               List<String> includes,
                               List<String> excludes)


Copyright © 2003-2012. All Rights Reserved.