com.googlecode.lightest.core
Class GroovyClassFinder

java.lang.Object
  extended by com.googlecode.lightest.core.GroovyClassFinder
All Implemented Interfaces:
groovy.lang.GroovyObject

public class GroovyClassFinder
extends Object
implements groovy.lang.GroovyObject

Capable of finding Groovy classes by package.


Constructor Summary
GroovyClassFinder()
           
GroovyClassFinder(ClassLoader classLoader, String testClassPath)
           
 
Method Summary
 List findByPackage(String packageName, List included, List excluded)
          Looks for Groovy classes using the currently set classpath that live in the specified package or package hierarchy, and returns their names in a List.
 List findByPackage(XmlPackage xmlPackage)
          Wraps the 3-argument form of findByPackage().
protected  void findClassesInDirPackage(String packageName, List included, List excluded, String packagePath, boolean recursive, List classes)
           
 ClassLoader getClassLoader()
           
 groovy.lang.MetaClass getMetaClass()
           
 Object getProperty(String name)
           
 Object invokeMethod(String name, Object args)
           
protected  boolean isIncluded(String name, List included, List excluded)
           
static void main(Object args)
           
 boolean matchesTestClasspath(URL url, String lastFragment, boolean recursive)
          Whether a given URL for a file in a package matches or "is covered by" one of the classpaths set as the test classpath.
 void setClassLoader(ClassLoader value)
           
 void setMetaClass(groovy.lang.MetaClass metaClass)
           
 void setProperty(String name, Object value)
           
 void setTestClasspath(String testClassPath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroovyClassFinder

public GroovyClassFinder()

GroovyClassFinder

public GroovyClassFinder(ClassLoader classLoader,
                         String testClassPath)
Method Detail

getClassLoader

public ClassLoader getClassLoader()

setClassLoader

public void setClassLoader(ClassLoader value)

findByPackage

public List findByPackage(XmlPackage xmlPackage)
Wraps the 3-argument form of findByPackage().


findByPackage

public List findByPackage(String packageName,
                          List included,
                          List excluded)
Looks for Groovy classes using the currently set classpath that live in the specified package or package hierarchy, and returns their names in a List. Specific classes can be included or excluded. If a testClassPath has been set on this object, only that classes that are found on that class path are considered. If the class loader is not set on this instance before this method is called, the current Thread's context class loader will be used to load resources. The logic here mimics that of org.testng.internal.PackageUtils.findClassesInPackage() .

Parameters:
packageName -
included -
excluded -

setTestClasspath

public void setTestClasspath(String testClassPath)

matchesTestClasspath

public boolean matchesTestClasspath(URL url,
                                    String lastFragment,
                                    boolean recursive)
Whether a given URL for a file in a package matches or "is covered by" one of the classpaths set as the test classpath. If no test classpath was specified, always returns true.

Parameters:
url - the URL of the resource to test
lastFragment - the package name to consider as an offset from each test classpath
recursive - whether resources contained in subpackages are considered matches

findClassesInDirPackage

protected void findClassesInDirPackage(String packageName,
                                       List included,
                                       List excluded,
                                       String packagePath,
                                       boolean recursive,
                                       List classes)

isIncluded

protected boolean isIncluded(String name,
                             List included,
                             List excluded)

main

public static void main(Object args)

getMetaClass

public groovy.lang.MetaClass getMetaClass()
Specified by:
getMetaClass in interface groovy.lang.GroovyObject

setMetaClass

public void setMetaClass(groovy.lang.MetaClass metaClass)
Specified by:
setMetaClass in interface groovy.lang.GroovyObject

invokeMethod

public Object invokeMethod(String name,
                           Object args)
Specified by:
invokeMethod in interface groovy.lang.GroovyObject

getProperty

public Object getProperty(String name)
Specified by:
getProperty in interface groovy.lang.GroovyObject

setProperty

public void setProperty(String name,
                        Object value)
Specified by:
setProperty in interface groovy.lang.GroovyObject


Copyright © 2009. All Rights Reserved.