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(java.lang.Class<?> type)
Add a component type to the injector.
|
void |
addComponent(java.lang.Object obj)
Add a component object to the injector.
|
<T> LenskitBinding<T> |
bind(java.lang.Class<? extends java.lang.annotation.Annotation> qual,
java.lang.Class<T> type) |
<T> LenskitBinding<T> |
bindAny(java.lang.Class<T> type) |
LenskitConfigContext |
in(java.lang.annotation.Annotation qualifier,
java.lang.Class<?> type)
Deprecated.
|
LenskitConfigContext |
in(java.lang.Class<?> type)
Deprecated.
|
LenskitConfigContext |
in(java.lang.Class<? extends java.lang.annotation.Annotation> qualifier,
java.lang.Class<?> type)
Deprecated.
|
Binding |
set(java.lang.Class<? extends java.lang.annotation.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(java.lang.Class<? extends java.lang.annotation.Annotation> qual, java.lang.Class<T> type)
bind
in interface Context
bind
in interface LenskitConfigContext
bind
in class AbstractContext
public <T> LenskitBinding<T> bindAny(java.lang.Class<T> type)
bindAny
in interface Context
bindAny
in interface LenskitConfigContext
bindAny
in class AbstractContext
public Binding set(@Nonnull java.lang.Class<? extends java.lang.annotation.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 java.lang.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 java.lang.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(java.lang.Class<?> type)
in
in interface Context
in
in interface LenskitConfigContext
in
in class AbstractContext
@Deprecated public LenskitConfigContext in(@Nullable java.lang.Class<? extends java.lang.annotation.Annotation> qualifier, java.lang.Class<?> type)
in
in interface Context
in
in interface LenskitConfigContext
in
in class AbstractContext
@Deprecated public LenskitConfigContext in(@Nullable java.lang.annotation.Annotation qualifier, java.lang.Class<?> type)
in
in interface Context
in
in interface LenskitConfigContext
in
in class AbstractContext