public class BindingDSL
extends org.lenskit.inject.AbstractConfigContext
Groovy DSL definition for configuring LensKit recommenders. This class is the base class of configuration scripts and the delegate against which configuration blocks are run.
The fact that this extends AbstractConfigContext is basically an implementation detail, to make sure that we always provide proxies for all the methods.
| Modifier and Type | Method and Description |
|---|---|
void |
addComponent(Object obj) |
org.lenskit.LenskitConfigContext |
at(Annotation qualifier,
Class<?> type) |
org.lenskit.LenskitConfigContext |
at(Annotation qualifier,
Class<?> type,
groovy.lang.Closure<?> block)
Enclose a block of configuration in a context.
|
org.lenskit.LenskitConfigContext |
at(Class<?> type) |
org.lenskit.LenskitConfigContext |
at(Class<?> type,
groovy.lang.Closure<?> block)
Configure inside an anchored context using a block.
|
org.lenskit.LenskitConfigContext |
at(Class<? extends Annotation> qualifier,
Class<?> type) |
org.lenskit.LenskitConfigContext |
at(Class<? extends Annotation> qualifier,
Class<?> type,
groovy.lang.Closure<?> block)
Enclose a block of configuration in a context.
|
<T> org.lenskit.LenskitBinding<T> |
bind(Class<? extends Annotation> qual,
Class<T> type) |
<T> org.lenskit.LenskitBinding<T> |
bind(Class<T> type) |
<T> org.lenskit.LenskitBinding<T> |
bindAny(Class<T> type) |
org.lenskit.data.ratings.PreferenceDomain |
domain(Map<String,Object> args)
Make and bind a preference domain.
|
org.lenskit.LenskitConfigContext |
getContext()
Get the LensKit context.
|
void |
include(groovy.lang.Closure<?> cl)
Use a closure as additional configuration
|
void |
include(Module mod)
Include a module in this configuration.
|
void |
include(String file)
Include another configuration file.
|
void |
include(URI uri)
Include another configuration file.
|
org.lenskit.LenskitConfigContext |
matching(ContextPattern pattern) |
Context |
matching(ContextPattern pattern,
groovy.lang.Closure<?> block) |
org.lenskit.data.ratings.PreferenceDomain |
prefDomain(Map<String,Object> args)
Make a preference domain.
|
Binding |
set(Class<? extends Annotation> param) |
org.lenskit.LenskitConfigContext |
within(Annotation qualifier,
Class<?> type) |
org.lenskit.LenskitConfigContext |
within(Annotation qualifier,
Class<?> type,
groovy.lang.Closure<?> block)
Enclose a block of configuration in a context.
|
org.lenskit.LenskitConfigContext |
within(Class<?> type) |
org.lenskit.LenskitConfigContext |
within(Class<?> type,
groovy.lang.Closure<?> block)
Enclose a block of configuration in a context.
|
org.lenskit.LenskitConfigContext |
within(Class<? extends Annotation> qualifier,
Class<?> type) |
org.lenskit.LenskitConfigContext |
within(Class<? extends Annotation> qualifier,
Class<?> type,
groovy.lang.Closure<?> block)
Enclose a block of configuration in a context.
|
public org.lenskit.LenskitConfigContext getContext()
Get the LensKit context.
public void include(groovy.lang.Closure<?> cl)
Use a closure as additional configuration
cl - A closure that is run on this context to do additional configuration.public void include(URI uri) throws IOException, org.lenskit.RecommenderConfigurationException
Include another configuration file.
uri - The URI of the configuration file.IOException - if an error is thrown loading the script.org.lenskit.RecommenderConfigurationException - if there is an error running the script.UnsupportedOperationException - if the current context does not support loading.public void include(String file) throws IOException, org.lenskit.RecommenderConfigurationException
Include another configuration file.
file - The configuration file name or URI.IOExceptionorg.lenskit.RecommenderConfigurationExceptioninclude(URI)public void include(Module mod)
Include a module in this configuration.
mod - The module to include.public <T> org.lenskit.LenskitBinding<T> bind(Class<T> type)
LenskitConfigContext.bind(Class)public <T> org.lenskit.LenskitBinding<T> bind(Class<? extends Annotation> qual, Class<T> type)
public <T> org.lenskit.LenskitBinding<T> bindAny(Class<T> type)
public Binding set(@Nonnull Class<? extends Annotation> param)
set in interface org.lenskit.LenskitConfigContextset in class org.lenskit.inject.AbstractConfigContextLenskitConfigContext.set(Class)public void addComponent(@Nonnull Object obj)
addComponent in interface org.lenskit.LenskitConfigContextaddComponent in class org.lenskit.inject.AbstractConfigContextpublic org.lenskit.LenskitConfigContext within(Class<?> type)
LenskitConfigContext.within(Class)public org.lenskit.LenskitConfigContext within(Class<?> type, groovy.lang.Closure<?> block)
Enclose a block of configuration in a context. The block is invoked with a delegate that adds bindings within the specified context.
type - The type to match for the context.block - The configuration block.LenskitConfigContext.within(Class)public org.lenskit.LenskitConfigContext within(@Nullable Class<? extends Annotation> qualifier, Class<?> type)
LenskitConfigContext.within(Class, Class)public org.lenskit.LenskitConfigContext within(@Nullable Class<? extends Annotation> qualifier, Class<?> type, groovy.lang.Closure<?> block)
Enclose a block of configuration in a context.
qualifier - The qualifier.type - The type to match for the context.block - The configuration block.LenskitConfigContext.within(Class, Class),
within(Class, Closure)public org.lenskit.LenskitConfigContext within(@Nullable Annotation qualifier, Class<?> type)
LenskitConfigContext.within(Annotation, Class)public org.lenskit.LenskitConfigContext within(@Nullable Annotation qualifier, Class<?> type, groovy.lang.Closure<?> block)
Enclose a block of configuration in a context.
qualifier - The qualifier.type - The type to match for the context.block - The configuration block.LenskitConfigContext.within(Annotation, Class),
within(Class, Closure)public org.lenskit.LenskitConfigContext matching(ContextPattern pattern)
public Context matching(ContextPattern pattern, groovy.lang.Closure<?> block)
public org.lenskit.LenskitConfigContext at(Class<?> type)
LenskitConfigContext.at(Class)public org.lenskit.LenskitConfigContext at(Class<?> type, groovy.lang.Closure<?> block)
Configure inside an anchored context using a block.
type - The type.block - The configuration block.within(Class, Closure)public org.lenskit.LenskitConfigContext at(@Nullable Class<? extends Annotation> qualifier, Class<?> type)
LenskitConfigContext.at(Class, Class)public org.lenskit.LenskitConfigContext at(@Nullable Class<? extends Annotation> qualifier, Class<?> type, groovy.lang.Closure<?> block)
Enclose a block of configuration in a context.
qualifier - The qualifier.type - The type to match for the context.block - The configuration block.LenskitConfigContext.at(Class, Class),
at(Class, Closure)public org.lenskit.LenskitConfigContext at(@Nullable Annotation qualifier, Class<?> type)
LenskitConfigContext.at(Annotation, Class)public org.lenskit.LenskitConfigContext at(@Nullable Annotation qualifier, Class<?> type, groovy.lang.Closure<?> block)
Enclose a block of configuration in a context.
qualifier - The qualifier.type - The type to match for the context.block - The configuration block.LenskitConfigContext.at(Annotation, Class),
at(Class, Closure)public org.lenskit.data.ratings.PreferenceDomain domain(Map<String,Object> args)
Make and bind a preference domain. With this method, this:
domain minimum: 1, maximum: 5
is equivalent to:
bind PreferenceDomain to prefDomain(minimum: 1, maximum: 5)
args - The arguments.prefDomain(java.util.Map)public org.lenskit.data.ratings.PreferenceDomain prefDomain(Map<String,Object> args)
Make a preference domain. This method takes three named arguments:
args - The arguments.PreferenceDomain