public class ConfigHelpers extends Object
LensKit configuration helper utilities.
| Modifier and Type | Method and Description |
|---|---|
static void |
configure(LenskitConfiguration config,
groovy.lang.Closure<?> block)
Modify a configuration from a closure.
|
static LenskitConfiguration |
load(groovy.lang.Closure<?> block)
Load a LensKit configuration from a Groovy closure.
|
static LenskitConfiguration |
load(File script)
Load a LensKit configuration from a script file.
|
static LenskitConfiguration |
load(String script)
Deprecated.
Loading from Groovy source strings is confusing.
|
static LenskitConfiguration |
load(URL script)
Load a LensKit configuration from a script URL.
|
public static LenskitConfiguration load(@DelegatesTo(value=LenskitConfigDSL.class) groovy.lang.Closure<?> block) throws RecommenderConfigurationException
Load a LensKit configuration from a Groovy closure. This is useful for using the Groovy DSL in unit tests.
block - The block to evaluate. This block will be evaluated with a delegate providing the LensKit DSL and the Closure.DELEGATE_FIRST resolution strategy.RecommenderConfigurationExceptionConfigurationLoader.load(groovy.lang.Closure)@Deprecated public static LenskitConfiguration load(String script) throws RecommenderConfigurationException
Load a LensKit configuration from a script (as a string).
script - The script source text to evaluate.RecommenderConfigurationExceptionpublic static LenskitConfiguration load(File script) throws IOException, RecommenderConfigurationException
Load a LensKit configuration from a script file.
script - The script source file to evaluate.IOExceptionRecommenderConfigurationExceptionpublic static LenskitConfiguration load(URL script) throws IOException, RecommenderConfigurationException
Load a LensKit configuration from a script URL.
script - The script source URL to evaluate.IOExceptionRecommenderConfigurationExceptionpublic static void configure(LenskitConfiguration config, @Nonnull @DelegatesTo(value=LenskitConfigDSL.class) groovy.lang.Closure<?> block) throws RecommenderConfigurationException
Modify a configuration from a closure. The class loader is not really consulted in this case.
block - The block to evaluate. This block will be evaluated with a delegate providing the LensKit DSL and the Closure.DELEGATE_FIRST resolution strategy.RecommenderConfigurationException