public class BindingDSL extends AbstractConfigContext
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(java.lang.Object obj)
Add a component object to the injector.
|
LenskitConfigContext |
at(java.lang.annotation.Annotation qualifier,
java.lang.Class<?> type) |
LenskitConfigContext |
at(java.lang.annotation.Annotation qualifier,
java.lang.Class<?> type,
groovy.lang.Closure<?> block)
Enclose a block of configuration in a context.
|
LenskitConfigContext |
at(java.lang.Class<?> type) |
LenskitConfigContext |
at(java.lang.Class<?> type,
groovy.lang.Closure<?> block)
Configure inside an anchored context using a block.
|
LenskitConfigContext |
at(java.lang.Class<? extends java.lang.annotation.Annotation> qualifier,
java.lang.Class<?> type) |
LenskitConfigContext |
at(java.lang.Class<? extends java.lang.annotation.Annotation> qualifier,
java.lang.Class<?> type,
groovy.lang.Closure<?> block)
Enclose a block of configuration in a context.
|
<T> LenskitBinding<T> |
bind(java.lang.Class<? extends java.lang.annotation.Annotation> qual,
java.lang.Class<T> type) |
<T> LenskitBinding<T> |
bind(java.lang.Class<T> type) |
<T> LenskitBinding<T> |
bindAny(java.lang.Class<T> type) |
PreferenceDomain |
domain(java.util.Map<java.lang.String,java.lang.Object> args)
Make and bind a preference domain.
|
LenskitConfigContext |
getContext()
Get the LensKit context.
|
void |
include(groovy.lang.Closure<?> cl)
Use a closure as additional configuration
|
void |
include(java.io.File file)
Include another configuration file.
|
void |
include(Module mod)
Include a module in this configuration.
|
void |
include(java.lang.String file)
Include another configuration file.
|
LenskitConfigContext |
matching(ContextPattern pattern) |
Context |
matching(ContextPattern pattern,
groovy.lang.Closure<?> block) |
PreferenceDomain |
prefDomain(java.util.Map<java.lang.String,java.lang.Object> args)
Make a preference domain.
|
Binding |
set(java.lang.Class<? extends java.lang.annotation.Annotation> param)
Start a binding that sets a parameter.
|
LenskitConfigContext |
within(java.lang.annotation.Annotation qualifier,
java.lang.Class<?> type) |
LenskitConfigContext |
within(java.lang.annotation.Annotation qualifier,
java.lang.Class<?> type,
groovy.lang.Closure<?> block)
Enclose a block of configuration in a context.
|
LenskitConfigContext |
within(java.lang.Class<?> type) |
LenskitConfigContext |
within(java.lang.Class<?> type,
groovy.lang.Closure<?> block)
Enclose a block of configuration in a context.
|
LenskitConfigContext |
within(java.lang.Class<? extends java.lang.annotation.Annotation> qualifier,
java.lang.Class<?> type) |
LenskitConfigContext |
within(java.lang.Class<? extends java.lang.annotation.Annotation> qualifier,
java.lang.Class<?> type,
groovy.lang.Closure<?> block)
Enclose a block of configuration in a context.
|
addComponent, in, in, in, wrapContextpublic LenskitConfigContext getContext()
public void include(groovy.lang.Closure<?> cl)
cl - A closure that is run on this context to do additional configuration.public void include(java.io.File file)
throws java.io.IOException,
RecommenderConfigurationException
file - The configuration file.java.io.IOException - if an error is thrown loading the script.RecommenderConfigurationException - if there is an error running the script.java.lang.UnsupportedOperationException - if the current context does not support loading.public void include(java.lang.String file)
throws java.io.IOException,
RecommenderConfigurationException
file - The configuration file.java.io.IOExceptionRecommenderConfigurationExceptioninclude(File)public void include(Module mod)
mod - The module to include.public <T> LenskitBinding<T> bind(java.lang.Class<T> type)
LenskitConfigContext.bind(Class)public <T> LenskitBinding<T> bind(java.lang.Class<? extends java.lang.annotation.Annotation> qual, java.lang.Class<T> type)
bind in interface Contextbind in interface LenskitConfigContextbind in class AbstractConfigContextLenskitConfigContext.bind(Class, Class)public <T> LenskitBinding<T> bindAny(java.lang.Class<T> type)
bindAny in interface ContextbindAny in interface LenskitConfigContextbindAny in class AbstractConfigContextLenskitConfigContext.bindAny(Class)public Binding set(java.lang.Class<? extends java.lang.annotation.Annotation> param)
LenskitConfigContextParameter annotation.set in interface LenskitConfigContextset in class AbstractConfigContextparam - The parameter to set.LenskitConfigContext.set(Class)public void addComponent(@Nonnull
java.lang.Object obj)
LenskitConfigContextthis.bind(obj.getClass()).to(obj);
It has the result of making obj available satisfy dependencies on its class or,
via supertype binding generation, any of its supertypes. Explicit bindings for those
supertypes will override this binding.
addComponent in interface LenskitConfigContextaddComponent in class AbstractConfigContextobj - The object to register.public LenskitConfigContext within(java.lang.Class<?> type)
LenskitConfigContext.within(Class)public LenskitConfigContext within(java.lang.Class<?> type, groovy.lang.Closure<?> block)
type - The type to match for the context.block - The configuration block.LenskitConfigContext.within(Class)public LenskitConfigContext within(@Nullable java.lang.Class<? extends java.lang.annotation.Annotation> qualifier, java.lang.Class<?> type)
public LenskitConfigContext within(@Nullable java.lang.Class<? extends java.lang.annotation.Annotation> qualifier, java.lang.Class<?> type, groovy.lang.Closure<?> block)
qualifier - The qualifier.type - The type to match for the context.block - The configuration block.LenskitConfigContext.within(Class, Class),
within(Class, Closure)public LenskitConfigContext within(@Nullable java.lang.annotation.Annotation qualifier, java.lang.Class<?> type)
public LenskitConfigContext within(@Nullable java.lang.annotation.Annotation qualifier, java.lang.Class<?> type, groovy.lang.Closure<?> block)
qualifier - The qualifier.type - The type to match for the context.block - The configuration block.LenskitConfigContext.within(Annotation, Class),
within(Class, Closure)public LenskitConfigContext matching(ContextPattern pattern)
public Context matching(ContextPattern pattern, groovy.lang.Closure<?> block)
public LenskitConfigContext at(java.lang.Class<?> type)
LenskitConfigContext.at(Class)public LenskitConfigContext at(java.lang.Class<?> type, groovy.lang.Closure<?> block)
type - The type.block - The configuration block.within(Class, Closure)public LenskitConfigContext at(@Nullable java.lang.Class<? extends java.lang.annotation.Annotation> qualifier, java.lang.Class<?> type)
public LenskitConfigContext at(@Nullable java.lang.Class<? extends java.lang.annotation.Annotation> qualifier, java.lang.Class<?> type, groovy.lang.Closure<?> block)
qualifier - The qualifier.type - The type to match for the context.block - The configuration block.LenskitConfigContext.at(Class, Class),
at(Class, Closure)public LenskitConfigContext at(@Nullable java.lang.annotation.Annotation qualifier, java.lang.Class<?> type)
public LenskitConfigContext at(@Nullable java.lang.annotation.Annotation qualifier, java.lang.Class<?> type, groovy.lang.Closure<?> block)
qualifier - The qualifier.type - The type to match for the context.block - The configuration block.LenskitConfigContext.at(Annotation, Class),
at(Class, Closure)public PreferenceDomain domain(java.util.Map<java.lang.String,java.lang.Object> args)
domain minimum: 1, maximum: 5
is equivalent to:
bind PreferenceDomain to prefDomain(minimum: 1, maximum: 5)
args - The arguments.prefDomain(java.util.Map)public PreferenceDomain prefDomain(java.util.Map<java.lang.String,java.lang.Object> args)
args - The arguments.PreferenceDomain