package inject
- Alphabetic
- Public
- Protected
Package Members
Type Members
- case class Flags extends Product with Serializable
Transforms a com.twitter.app.Flags collection into a map look up
- abstract class Injector extends AnyRef
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 viaTestInjector.apply
DO NOT EXTEND this class on your own.
- abstract class StackTransformer extends Transformer
StackTransformer allows plugins to modify Finatra filters before they are applied to controller routes.
StackTransformer allows plugins to modify Finatra filters before they are applied to controller routes.
Related to the Finagle com.twitter.finagle.StackTransformer, which modifies Finagle server stacks, the Finatra StackTransformer modifies Finatra controller routes.
If the goal is to share functionality between Finagle and Finatra, it's reasonable to want to use Finagle's StackTransformer directly on Finatra routes. However, the unit of functionality, and therefore meaningful reuse, is the stack module - the StackTransformer merely adapts stack modules to various stack contexts.
The stack module as the unit of reuse also makes it possible to install them in specific contexts; for example, modules that should be installed at the service-level but not at the route-level (e.g. admission controllers).
- abstract class TwitterModule extends AbstractModule with TwitterBaseModule with ScalaModule with util.logging.Logging
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 thebind
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.
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
Example: - abstract class TwitterPrivateModule extends PrivateModule with TwitterBaseModule with ScalaPrivateModule
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
Deprecated Type Members
- trait Logging extends util.logging.Logging
Mix this trait into a class/object to get helpful logging methods.
Mix this trait into a class/object to get helpful logging methods.
- Annotations
- @deprecated
- Deprecated
(Since version 2022-01-27) Use c.t.util.logging.Logging directly
- Note
This trait simply adds several methods to the com.twitter.util.logging.Logging trait. The methods below are used as so: Before:
def foo = { val result = 4 + 5 debugFutureResult("Foo returned " + result) result }
After:
def foo = { debugFutureResult("Foo returned %s") { 4 + 5 } }
Value Members
- object Injector
- object InjectorModule extends TwitterModule
- object TypeUtils