Interface Binder


public interface Binder
An object passed to a BQModule by the DI container during initialization, that provides the API for the module to bind its services to the container. Note that the default Scope of the bound objects is normally "singleton" and can be changed to "no scope" or a custom scope via a corresponding method of a binding builder. E.g. see ScopeBuilder.in(Scope).
  • Method Details

    • bind

      <T> BindingBuilder<T> bind(Class<T> interfaceType)
      Starts an unnamed binding of a specific interface. Binding should continue using returned BindingBuilder.
    • bind

      <T> BindingBuilder<T> bind(Class<T> interfaceType, Class<? extends Annotation> annotationType)
      Starts a binding of a specific interface denoted by specified annotation. Binding should continue using returned BindingBuilder.
    • bind

      <T> BindingBuilder<T> bind(Class<T> interfaceType, String bindingName)
      Starts a named binding of a specific interface. Binding should continue using returned BindingBuilder.
    • bind

      <T> BindingBuilder<T> bind(Key<T> key)
      Starts a binding of a specific interface based on a provided binding key. This method is more generic than bind(Class) and allows to create named bindings in addition to default ones. Binding should continue using returned BindingBuilder.
    • bindOptional

      <T> BindingBuilder<T> bindOptional(Class<T> interfaceType)
      Starts an unnamed optional binding of a specific interface. Binding should continue using returned BindingBuilder.
    • bindOptional

      <T> BindingBuilder<T> bindOptional(Key<T> key)
      Starts an optional binding of a specific interface based on a provided binding key. This method is more generic than bind(Class) and allows to create qualified bindings in addition to default ones. Binding should continue using returned BindingBuilder.
    • override

      <T> BindingBuilder<T> override(Class<T> interfaceType)
      Start override binding of a specific interface.
      Type Parameters:
      T - binding type
      Parameters:
      interfaceType - to override
      Returns:
      binding builder to continue override
    • override

      <T> BindingBuilder<T> override(Key<T> key)
      Start override binding of a specific interface based on a provided binding key.
      Type Parameters:
      T - binding type
      Parameters:
      key - to override
      Returns:
      binding builder to continue override
    • bindMap

      <K, V> MapBuilder<K,V> bindMap(Class<K> keyType, Class<V> valueType, Class<? extends Annotation> qualifier)
      Starts a binding of a java.util.Map<K, V> distinguished by its keys type, values type and qualifier annotation. Map binding should continue using returned MapBuilder. This is a type safe way of binding a map.
    • bindMap

      <K, V> MapBuilder<K,V> bindMap(Class<K> keyType, Class<V> valueType, String bindingName)
      Starts a binding of a java.util.Map<K, V> distinguished by its keys type, values type and binding name. Map binding should continue using returned MapBuilder. This is a type safe way of binding a map.
    • bindMap

      <K, V> MapBuilder<K,V> bindMap(Class<K> keyType, Class<V> valueType)
      Starts a binding of a java.util.Map<K, V> distinguished by its keys and values type. Map binding should continue using returned MapBuilder. This is a type safe way of binding a map.
    • bindMap

      <K, V> MapBuilder<K,V> bindMap(TypeLiteral<K> keyType, TypeLiteral<V> valueType, Class<? extends Annotation> qualifier)
      Starts a binding of a java.util.Map<K, V> distinguished by its keys type, values type and qualifier annotation. Map binding should continue using returned MapBuilder. This is a type safe way of binding a map.
    • bindMap

      <K, V> MapBuilder<K,V> bindMap(TypeLiteral<K> keyType, TypeLiteral<V> valueType, String bindingName)
      Starts a binding of a java.util.Map<K, V> distinguished by its keys type, values type and binding name. Map binding should continue using returned MapBuilder. This is a type safe way of binding a map.
    • bindMap

      <K, V> MapBuilder<K,V> bindMap(TypeLiteral<K> keyType, TypeLiteral<V> valueType)
      Starts a binding of a java.util.Map<K, V> distinguished by its keys and values type. Map binding should continue using returned MapBuilder. This is a type safe way of binding a map.
    • bindSet

      <T> SetBuilder<T> bindSet(Class<T> valueType, Class<? extends Annotation> qualifier)
      Starts a binding of a java.util.Set<T> distinguished by its values type and qualifier annotation. Set binding should continue using returned SetBuilder. This is somewhat equivalent of using "bind(Set.class, qualifier)", however returned SetBuilder provides type safety and extra DI capabilities.
    • bindSet

      <T> SetBuilder<T> bindSet(Class<T> valueType, String bindingName)
      Starts a binding of a java.util.Set<T> distinguished by its values type and binding name. Set binding should continue using returned SetBuilder. This is somewhat equivalent of using "bind(Set.class, bindingName)", however returned SetBuilder provides type safety and extra DI capabilities.
    • bindSet

      <T> SetBuilder<T> bindSet(Class<T> valueType)
      Starts a binding of a java.util.Set<T> distinguished by its values type. Set binding should continue using returned SetBuilder. This is somewhat equivalent of using "bind(Set.class, bindingName)", however returned SetBuilder provides type safety and extra DI capabilities.
    • bindSet

      <T> SetBuilder<T> bindSet(TypeLiteral<T> valueType, Class<? extends Annotation> qualifier)
      Starts a binding of a java.util.Set<T> distinguished by its values type and qualifier annotation. Set binding should continue using returned SetBuilder. This is somewhat equivalent of using "bind(Set.class, qualifier)", however returned SetBuilder provides type safety and extra DI capabilities.
    • bindSet

      <T> SetBuilder<T> bindSet(TypeLiteral<T> valueType, String bindingName)
      Starts a binding of a java.util.Set<T> distinguished by its values type and binding name. Set binding should continue using returned SetBuilder. This is somewhat equivalent of using "bind(Set.class, bindingName)", however returned SetBuilder provides type safety and extra DI capabilities.
    • bindSet

      <T> SetBuilder<T> bindSet(TypeLiteral<T> valueType)
      Starts a binding of a java.util.Set<T> distinguished by its values type. Set binding should continue using returned SetBuilder. This is somewhat equivalent of using "bind(Set.class, bindingName)", however returned SetBuilder provides type safety and extra DI capabilities.
    • decorate

      <T> DecoratorBuilder<T> decorate(Class<T> interfaceType)
    • decorate

      <T> DecoratorBuilder<T> decorate(Key<T> key)