Package

com.twitter

inject

Permalink

package inject

Visibility
  1. Public
  2. All

Type Members

  1. case class Flags extends Product with Serializable

    Permalink

    Transforms a com.twitter.app.Flags collection into a map look up

  2. abstract class Injector extends AnyRef

    Permalink

    An injector used within Finatra.

    An injector used within Finatra.

    This is abstract class to allow for two implementations:

    - production injector, created via Injector.apply and - test injector, created via TestInjector.apply

    DO NOT EXTEND this class on your own.

  3. abstract class TwitterModule extends AbstractModule with TwitterBaseModule with ScalaModule with Logging

    Permalink

    A support class for Module implementations which exposes a DSL for binding via type parameters.

    Overview

    A support class for Module implementations which exposes a DSL for binding via type parameters. Extend this class, override the configure method and call the bind methods, or define custom @Provides annotated methods. This class also provides an integration with com.twitter.app.Flag types which allows for passing external configuration to aid in the creation of bound types. Lastly, it is also possible to define a list of other TwitterModule instances which this TwitterModule "depends" on by setting the TwitterBaseModule.modules (or TwitterBaseModule.javaModules) to a non-empty list. This will ensure that when only this TwitterModule instance is used to compose an Injector the "dependent" list of modules will also be installed.

    Lifecycle

    A TwitterModule has a lifecycle. Executing this lifecycle is particularly important if the TwitterModule creates any com.twitter.app.Flag instances.

    Example:
    1. object MyModule extends TwitterModule {
       flag[String](name = "card.gateway", help = "The processing gateway to use for credit cards.")
       override protected def configure(): Unit = {
         bind[Service].to[ServiceImpl].in[Singleton]
         bind[CreditCardPaymentService]
         bind[Bar[Foo]].to[FooBarImpl]
         bind[PaymentService].to[CreditCardPaymentService]
       }
       @Singleton
       @Provides
       def provideCreditCardServiceProcessor(
         @Flag("card.gateway") gateway: String
       ): CreditCardProcessor = {
         new CreditCardProcessor(gateway)
       }
      }
    Note

    Attempting to bind the same type multiple times with no discriminating com.google.inject.BindingAnnotation will result in an exception during injector construction.

    See also

    Writing Modules in Finatra

    com.google.inject.AbstractModule

  4. abstract class TwitterPrivateModule extends PrivateModule with TwitterBaseModule with ScalaPrivateModule

    Permalink

    A module whose configuration information is hidden from its environment by default.

    A module whose configuration information is hidden from its environment by default. Only bindings that are explicitly exposed will be available to other modules and to the users of the injector. This module may expose the bindings it creates and the bindings of the modules it installs.

    Note

    Calling com.google.inject.PrivateModule#install in the configure() method is not supported. Please set TwitterBaseModule.modules (or TwitterBaseModule.javaModules) to a non-empty list instead.

    See also

    Writing Modules in Finatra

    com.google.inject.PrivateModule

Value Members

  1. object Injector

    Permalink
  2. object InjectorModule extends TwitterModule

    Permalink
  3. object TypeUtils

    Permalink
  4. package internal

    Permalink

Ungrouped