public abstract class AbstractConfigContext extends AbstractContext implements LenskitConfigContext
Helper for implementing Lenskit config contexts.
Constructor and Description |
---|
AbstractConfigContext() |
Modifier and Type | Method and Description |
---|---|
void |
addComponent(Class<?> type)
Add a component type to the injector.
|
void |
addComponent(Object obj)
Add a component object to the injector.
|
<T> LenskitBinding<T> |
bind(Class<? extends Annotation> qual,
Class<T> type) |
<T> LenskitBinding<T> |
bindAny(Class<T> type) |
LenskitConfigContext |
in(Annotation qualifier,
Class<?> type)
Deprecated.
|
LenskitConfigContext |
in(Class<?> type)
Deprecated.
|
LenskitConfigContext |
in(Class<? extends Annotation> qualifier,
Class<?> type)
Deprecated.
|
Binding |
set(Class<? extends Annotation> param)
Start a binding that sets a parameter.
|
protected static LenskitConfigContext |
wrapContext(Context ctx)
Coerce a Grapht context to a LensKit context.
|
protected static LenskitConfigContext wrapContext(Context ctx)
Coerce a Grapht context to a LensKit context.
ctx
- The context.public <T> LenskitBinding<T> bind(Class<? extends Annotation> qual, Class<T> type)
bind
in interface Context
bind
in interface LenskitConfigContext
bind
in class AbstractContext
public <T> LenskitBinding<T> bindAny(Class<T> type)
bindAny
in interface Context
bindAny
in interface LenskitConfigContext
bindAny
in class AbstractContext
public Binding set(@Nonnull Class<? extends Annotation> param)
LenskitConfigContext
Start a binding that sets a parameter. Parameters are qualifiers that bear the Parameter
annotation.
set
in interface LenskitConfigContext
param
- The parameter to set.public void addComponent(@Nonnull Object obj)
LenskitConfigContext
Add a component object to the injector. This is the equivalent of:
this.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 LenskitConfigContext
obj
- The object to register.public void addComponent(@Nonnull Class<?> type)
LenskitConfigContext
Add a component type to the injector. This is the equivalent of:
this.bind(type).to(type);
It has the result of making type
available satisfy dependencies on itself or, via supertype binding generation, any of its supertypes. Explicit bindings for those supertypes will override this binding.
addComponent
in interface LenskitConfigContext
type
- The type to register.@Deprecated public LenskitConfigContext in(Class<?> type)
in
in interface Context
in
in interface LenskitConfigContext
in
in class AbstractContext
@Deprecated public LenskitConfigContext in(@Nullable Class<? extends Annotation> qualifier, Class<?> type)
in
in interface Context
in
in interface LenskitConfigContext
in
in class AbstractContext
@Deprecated public LenskitConfigContext in(@Nullable Annotation qualifier, Class<?> type)
in
in interface Context
in
in interface LenskitConfigContext
in
in class AbstractContext