21 package org.matsim.core.modal;
23 import java.lang.annotation.Annotation;
24 import java.util.function.Function;
28 import com.google.inject.Key;
29 import com.google.inject.Provider;
30 import com.google.inject.TypeLiteral;
31 import com.google.inject.
binder.LinkedBindingBuilder;
32 import com.google.inject.multibindings.MapBinder;
50 protected <T> Key<T> modalKey(Class<T> type) {
51 return modalAnnotationCreator.
key(type, mode);
54 protected <T> Key<T> modalKey(TypeLiteral<T> typeLiteral) {
55 return modalAnnotationCreator.
key(typeLiteral, mode);
58 protected <T> LinkedBindingBuilder<T> bindModal(Class<T> type) {
59 return bind(modalKey(type));
62 protected <T> LinkedBindingBuilder<T> bindModal(TypeLiteral<T> typeLiteral) {
63 return bind(modalKey(typeLiteral));
66 protected <K, V> MapBinder<K, V> modalMapBinder(Class<K> keyType, Class<V> valueType) {
67 return MapBinder.newMapBinder(
binder(), keyType, valueType, modalAnnotationCreator.
mode(
getMode()));
70 protected <K, V> MapBinder<K, V> modalMapBinder(TypeLiteral<K> keyType, TypeLiteral<V> valueType) {
71 return MapBinder.newMapBinder(
binder(), keyType, valueType, modalAnnotationCreator.
mode(
getMode()));
final ModalAnnotationCreator< M > modalAnnotationCreator
static< M extends Annotation, T > Provider< T > createProvider(String mode, ModalAnnotationCreator< M > modalAnnotationCreator, Function< InstanceGetter< M >, T > delegate)
AbstractModalModule(String mode, ModalAnnotationCreator< M > modalAnnotationCreator)
default< T > Key< T > key(Class< T > type, String mode)