Class DruidInjectorBuilder

  • Direct Known Subclasses:
    CoreInjectorBuilder, ExtensionInjectorBuilder, ServiceInjectorBuilder

    public class DruidInjectorBuilder
    extends Object
    Druid-enabled injector builder which supports DruidModules, module classes created from the base injector, and filtering based on properties and LoadScope annotations.

    Can be used in clients and tests, in which case no module filtering is done. Presumably, the test or client has already selected the modules that it needs.

    Druid injector builders can be chained with an earlier builder providing a set of modules which a later builder overrides. Again, this is typically used only in the server, not in clients or tests.

    • Field Detail

      • baseInjector

        protected final com.google.inject.Injector baseInjector
    • Constructor Detail

      • DruidInjectorBuilder

        public DruidInjectorBuilder​(com.google.inject.Injector baseInjector)
      • DruidInjectorBuilder

        public DruidInjectorBuilder​(com.google.inject.Injector baseInjector,
                                    Set<NodeRole> nodeRoles)
    • Method Detail

      • ignoreLoadScopes

        public DruidInjectorBuilder ignoreLoadScopes()
        Ignore load scope annotations on modules. Primarily for testing where a unit test is not any Druid node, and may wish to load a module that is annotated with a load scope.
      • addInput

        public DruidInjectorBuilder addInput​(Object input)
        Add an arbitrary Module, DruidModule instance, or a subclass of these classes. If a class is provided, it is instantiated using the base injector to allow dependency injection. If a module instance is provided, its members are injected. Note that such modules have visibility only to objects defined in the base injector, but not to objects defined in the injector being built.
      • modules

        public List<com.google.inject.Module> modules()
      • build

        public com.google.inject.Injector build()
      • baseInjector

        public com.google.inject.Injector baseInjector()