Class GuiceBuilder

java.lang.Object
com.peterphi.std.guice.apploader.impl.GuiceBuilder

public class GuiceBuilder extends Object
Build the specifications for a new guice framework environment
  • Constructor Details

    • GuiceBuilder

      public GuiceBuilder()
  • Method Details

    • withRegistry

      public GuiceBuilder withRegistry(GuiceRegistry registry)
    • withScannerFactory

      public GuiceBuilder withScannerFactory(ClassScannerFactory scannerFactory)
    • withNoScannerFactory

      public GuiceBuilder withNoScannerFactory()
    • withRole

      public GuiceBuilder withRole(GuiceRole... roles)
    • withAutoLoadRoles

      public GuiceBuilder withAutoLoadRoles(boolean autoLoadRoles)
    • withConfig

      public GuiceBuilder withConfig(PropertyFile... props)
    • withConfig

      public GuiceBuilder withConfig(String... filenames)
    • withConfig

      public GuiceBuilder withConfig(Properties... configs)
    • withSetup

      public GuiceBuilder withSetup(Class<? extends GuiceSetup> clazz)
    • withSetup

      public GuiceBuilder withSetup(GuiceSetup setup)
    • withClassloader

      public GuiceBuilder withClassloader(ClassLoader classloader)
    • withAutoLoadProperties

      public GuiceBuilder withAutoLoadProperties(boolean autoLoadProperties)
    • isAutoLoadProperties

      public boolean isAutoLoadProperties()
    • build

      public com.google.inject.Injector build()
      Instantiate the guice environment. For information on what's involved in this process see GuiceFactory.build(GuiceRegistry, ClassScannerFactory, List, List, GuiceSetup, boolean, boolean, ClassLoader) and GuiceFactory.createInjector(GuiceRegistry, ClassScannerFactory, GuiceConfig, GuiceSetup, List)
      Returns:
    • forTesting

      public static GuiceBuilder forTesting()
      Construct a GuiceBuilder with sensible defaults for testing
      Returns:
    • forTesting

      public static GuiceBuilder forTesting(com.google.inject.Module... modules)
      Construct a GuiceBuilder with sensible defaults for testing. Adds the provided modules (wrapped in a BasicSetup automatically) to the environment that will be constructed
      Parameters:
      modules -
      Returns: