Class GroovyContext
- java.lang.Object
-
- org.jbehave.core.configuration.groovy.GroovyContext
-
public class GroovyContext extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GroovyContext.GroovyClassInstantiationFailed
static class
GroovyContext.GroovyInstanceNotFound
-
Constructor Summary
Constructors Constructor Description GroovyContext()
GroovyContext(groovy.lang.GroovyClassLoader classLoader, List<String> resources)
GroovyContext(groovy.lang.GroovyClassLoader classLoader, GroovyResourceFinder resourceFinder)
GroovyContext(List<String> resources)
GroovyContext(GroovyResourceFinder resourceFinder)
-
Method Summary
Modifier and Type Method Description <T> T
getInstanceOfType(Class<T> type)
List<Object>
getInstances()
Object
newInstance(Class<?> parsedClass)
Creates an instance from the parsed Groovy class.Object
newInstance(String resource)
Creates an object instance from the Groovy resource
-
-
-
Constructor Detail
-
GroovyContext
public GroovyContext()
-
GroovyContext
public GroovyContext(GroovyResourceFinder resourceFinder)
-
GroovyContext
public GroovyContext(groovy.lang.GroovyClassLoader classLoader, GroovyResourceFinder resourceFinder)
-
-
Method Detail
-
getInstanceOfType
public <T> T getInstanceOfType(Class<T> type)
-
newInstance
public Object newInstance(String resource)
Creates an object instance from the Groovy resource- Parameters:
resource
- the Groovy resource to parse- Returns:
- An Object instance
-
newInstance
public Object newInstance(Class<?> parsedClass) throws Exception
Creates an instance from the parsed Groovy class. This method can be overriden to do some dependency injection on Groovy classes.- Parameters:
parsedClass
- the parsed Class to instantiate- Returns:
- An Object instance of the parsed Class
- Throws:
Exception
- if instantiation or injection fails
-
-