Class InjectorCreationEvent


  • public class InjectorCreationEvent
    extends RunPhaseEvent
    Called just before guice injector creation. Provides all configured modules (main and override) and all disabled modules. Called even if no modules were used at all (to indicate major lifecycle point).

    Modules may be post-processed here (e.g. some special marker interface support may be implemented here).

    Since:
    19.04.2018
    • Constructor Detail

      • InjectorCreationEvent

        public InjectorCreationEvent​(EventsContext context,
                                     java.util.List<com.google.inject.Module> modules,
                                     java.util.List<com.google.inject.Module> overriding,
                                     java.util.List<com.google.inject.Module> disabled,
                                     java.util.List<com.google.inject.Module> ignored)
    • Method Detail

      • getModules

        public java.util.List<com.google.inject.Module> getModules()
        NOTE: if bindings analysis is enabled (GuiceyOptions.AnalyzeGuiceModules) then these modules were already processed and repackaged (in order to remove disabled inner modules and extensions). This list is useful for information only and any modifications to module instances makes no sense.
        Returns:
        list of all enabled guice modules or empty list if no modules registered or all of them were disabled
      • getOverridingModules

        public java.util.List<com.google.inject.Module> getOverridingModules()
        In contrast to normal modules, which are repackaged during bindings analysis, overriding modules are always used as is and so instances may be modified (modules configuration called after this event).
        Returns:
        list of all overriding guice modules or empty list if not overriding modules registered or all of them were disabled
      • getDisabled

        public java.util.List<com.google.inject.Module> getDisabled()
        Returns:
        list of all disabled modules or empty list
      • getIgnored

        public java.util.List<com.google.inject.Module> getIgnored()
        Returns:
        list of all ignored modules (duplicates) or empty list