se.biltmore.tools.odttoapt.maven.plugin
Class SourcePath

java.lang.Object
  extended by se.biltmore.tools.odttoapt.maven.plugin.SourcePath

public class SourcePath
extends Object


Field Summary
private  String fileRegexpFilter
          A regular expression filter to apply to each found file.
private  File path
          The path under which to look for source files.
private  boolean recursive
          If true source files will be searched for recursively, otherwise only in the direct path.
 
Constructor Summary
SourcePath(File path)
          Creates a new instance.
SourcePath(File path, boolean recursive, String fileRegexpFilter)
          Creates a new instance.
SourcePath(String pathExpression)
          Creates a new instance.
 
Method Summary
private  void findSourceFiles(File currentPath, List<File> sourceFiles)
          Support method to recursively find files.
 List<File> getSourceFiles()
           
private  boolean isRegularExpression(String name)
          Returns true if the name is a regular expression.
 void setFileRegexpFilter(String fileRegexpFilter)
          Supply a file filter using a regular expression.
 void setRecursive(boolean recursive)
          Sets recursive path or not.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

path

private File path
The path under which to look for source files.


recursive

private boolean recursive
If true source files will be searched for recursively, otherwise only in the direct path.


fileRegexpFilter

private String fileRegexpFilter
A regular expression filter to apply to each found file. Example "*.java"

Constructor Detail

SourcePath

public SourcePath(String pathExpression)
Creates a new instance.

This parses a String that must be in one of the following formats:

     /my/path
         All files in the directory pointed to by the path.

     /my/path/{star}{star}
         All files in the directory pointed to by the path and underlaying directories.

     /my/path/{star}{star}/{regexp pattern}
         All files matching the pattern in the directory pointed to by the path and udnderlaying directories.

     /my/path/{regexp pattern}
         All files matching the pattern in the directory pointed to by the path.
 

Parameters:
pathExpression - The path expression as explained above.

SourcePath

public SourcePath(File path)
Creates a new instance.

Parameters:
path - The path to supply source files for.

SourcePath

public SourcePath(File path,
                  boolean recursive,
                  String fileRegexpFilter)
Creates a new instance.

Parameters:
path - The path to supply source files for.
recursive - If true source files will be searched for recursively down the file structure.
fileRegexpFilter - A filter to apply for each file. Example "*.java". This can be null which means no filter.
Method Detail

isRegularExpression

private final boolean isRegularExpression(String name)
Returns true if the name is a regular expression.

Parameters:
name - The name to check.

setRecursive

public void setRecursive(boolean recursive)
Sets recursive path or not.

Parameters:
recursive - If true source files will be searched for recursively down the file structure.

setFileRegexpFilter

public void setFileRegexpFilter(String fileRegexpFilter)
Supply a file filter using a regular expression.

Parameters:
fileRegexpFilter - A filter to apply for each file. Example "*.java". This can be null which means no filter.

getSourceFiles

public List<File> getSourceFiles()
Returns:
Returns all the source files matching the path criteria.

findSourceFiles

private void findSourceFiles(File currentPath,
                             List<File> sourceFiles)
Support method to recursively find files.

Parameters:
currentPath - The path to start finding files in.
sourceFiles - Found files are added to this list.

toString

public String toString()
Overrides:
toString in class Object
Returns:
A String representation of the path.


Copyright © 2009-2010 Biltmore Group AB. All Rights Reserved.