public interface BindingExtensions
| Modifier and Type | Method and Description |
|---|---|
<From,Target extends From> |
bind(com.google.common.reflect.TypeToken<From> from,
com.google.common.reflect.TypeToken<Target> target) |
<From,Target extends From> |
bind(com.google.common.reflect.TypeToken<From> from,
com.google.common.reflect.TypeToken<Target> target,
java.lang.annotation.Annotation annotation) |
<From,Target extends From> |
bind(com.google.common.reflect.TypeToken<From> from,
com.google.common.reflect.TypeToken<Target> target,
java.lang.Class<? extends java.lang.annotation.Annotation> annotation) |
<From1 extends Component<?,?>,From2 extends Component<?,?>,From3 extends From1,Target extends From1> |
bind(com.google.common.reflect.TypeToken<From1> from1,
com.google.common.reflect.TypeToken<From2> from2,
com.google.common.reflect.TypeToken<From3> from3,
com.google.common.reflect.TypeToken<Target> target,
java.lang.annotation.Annotation componentAnnotation)
Full binding method for a component
|
<From1 extends Component<?,?>,From2 extends From1,Target extends From1> |
bind(com.google.common.reflect.TypeToken<From1> from1,
com.google.common.reflect.TypeToken<From2> from2,
com.google.common.reflect.TypeToken<Target> target,
java.lang.annotation.Annotation componentAnnotation)
Binding method for a component
|
static <T> com.google.inject.Key<T> |
getKey(com.google.common.reflect.TypeToken<T> typeToken) |
static <T> com.google.inject.TypeLiteral<T> |
getTypeLiteral(com.google.common.reflect.TypeToken<T> typeToken) |
void |
withMongoDB()
Binds the mongodb
DataStoreContext |
void |
withXodus()
Binds the xodus
DataStoreContext |
<From1 extends Component<?,?>,From2 extends Component<?,?>,From3 extends From1,Target extends From1> void bind(com.google.common.reflect.TypeToken<From1> from1, com.google.common.reflect.TypeToken<From2> from2, com.google.common.reflect.TypeToken<From3> from3, com.google.common.reflect.TypeToken<Target> target, java.lang.annotation.Annotation componentAnnotation)
A typical example of usage of this method:
be.bind(
new TypeToken<FooRepository<?, ?, ?>>(getClass()) {
},
new TypeToken<FooRepository<?, Foo<?, ?>>(getClass()) {
},
new TypeToken<FooRepository<ObjectId, Foo<ObjectId>, Datastore>>(getClass()) {
},
new TypeToken<CommonMongoFooRepository<TMongoFoo>>(getClass()) { // final implementation
},
Names.named("mongodb")
);
<From1 extends Component<?,?>,From2 extends From1,Target extends From1> void bind(com.google.common.reflect.TypeToken<From1> from1, com.google.common.reflect.TypeToken<From2> from2, com.google.common.reflect.TypeToken<Target> target, java.lang.annotation.Annotation componentAnnotation)
A typical example of usage of this method:
be.bind(
new TypeToken<FooRepository<?, ?>>(getClass()) {
},
new TypeToken<FooRepository<ObjectId, Datastore>>(getClass()) {
},
new TypeToken<CommonMongoFooRepository>(getClass()) { // final implementation
},
Names.named("mongodb")
);
<From,Target extends From> void bind(com.google.common.reflect.TypeToken<From> from,
com.google.common.reflect.TypeToken<Target> target,
java.lang.annotation.Annotation annotation)
<From,Target extends From> void bind(com.google.common.reflect.TypeToken<From> from,
com.google.common.reflect.TypeToken<Target> target,
java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
<From,Target extends From> void bind(com.google.common.reflect.TypeToken<From> from,
com.google.common.reflect.TypeToken<Target> target)
void withMongoDB()
DataStoreContext
Using this method is the same as invoking:
bind(new TypeLiteral<DataStoreContext<ObjectId, Datastore>>() {
}).to(MongoContext.class);
void withXodus()
DataStoreContext
Using this method is the same as invoking:
binder.bind(new TypeLiteral<DataStoreContext<EntityId, PersistentEntityStore>>() {
}).to(XodusContext.class);
static <T> com.google.inject.TypeLiteral<T> getTypeLiteral(com.google.common.reflect.TypeToken<T> typeToken)
static <T> com.google.inject.Key<T> getKey(com.google.common.reflect.TypeToken<T> typeToken)