Class Spincast

java.lang.Object
org.spincast.defaults.bootstrapping.Spincast

public class Spincast extends Object
Starts the initialization of a Spincast application.

Will create the final Guice Injector and return it when the init() method is called.

In addition to the methods directly provided by this bootstrapper, it is possible to tweak the resulting Guice context by using the GuiceTweaker class. The main use case where a tweaker may be useful, is to write test classes : the tweaker allows you to reuse the exact same code that bootstraps your application (often by calling its main(...) method), but to tweak some bindings, mock some components.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Starts the bootsrapping of a Spincast application, using the default plugins.
    static com.google.inject.Module
    Returns a module combining all the default plugins implementations, parametrized with the default Request and Websocket contextes.
    static com.google.inject.Module
    getDefaultModule(boolean includeCoreModule)
    Returns a module combining all the default plugins implementations, parametrized with the default Request and Websocket contextes.
    static com.google.inject.Module
    getDefaultModule(Class<? extends RequestContext<?>> requestContextImplementationClass, Class<? extends WebsocketContext<?>> websocketContextImplementationClass)
    Returns a module combining all the default plugins implementations.
    static com.google.inject.Module
    getDefaultModule(Class<? extends RequestContext<?>> requestContextImplementationClass, Class<? extends WebsocketContext<?>> websocketContextImplementationClass, boolean includeCoreModule)
    Returns a module combining all the default plugins implementations.
    static com.google.inject.Injector
    init(String[] args)
    Initialize a default Spincast application.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Spincast

      public Spincast()
  • Method Details

    • configure

      public static SpincastBootstrapper configure()
      Starts the bootsrapping of a Spincast application, using the default plugins.

      When the configuration is done, call the init() method to initialize the Guice context.

      By default, the caller class is going to be bound in the Guice context. If you want to disable this, call ".bindCallerClass(false)"!

      Returns:
      The bootstrapper
    • init

      public static com.google.inject.Injector init(String[] args)
      Initialize a default Spincast application.

      The caller class is going to be bound in the Guice context. You may want to add some kind of "@Inject init()" method in it and start your application there!

      The default Request Context type and the default Websocket Context type will be used.

      Parameters:
      args - The parameters received in the main method. Those will be bound in the Guice context and you will be able to inject them wherever you need, using the @MainArgs annotation.
      Returns:
      The create Guice Injector (context).
    • getDefaultModule

      public static com.google.inject.Module getDefaultModule()
      Returns a module combining all the default plugins implementations, parametrized with the default Request and Websocket contextes.

      The SpincastCoreGuiceModule module is included.

    • getDefaultModule

      public static com.google.inject.Module getDefaultModule(boolean includeCoreModule)
      Returns a module combining all the default plugins implementations, parametrized with the default Request and Websocket contextes.

      The SpincastCoreGuiceModule module is not included.

      Parameters:
      includeCoreModule - Should the Core module being added too?
    • getDefaultModule

      public static com.google.inject.Module getDefaultModule(Class<? extends RequestContext<?>> requestContextImplementationClass, Class<? extends WebsocketContext<?>> websocketContextImplementationClass)
      Returns a module combining all the default plugins implementations.

      The SpincastCoreGuiceModule module is not included.

    • getDefaultModule

      public static com.google.inject.Module getDefaultModule(Class<? extends RequestContext<?>> requestContextImplementationClass, Class<? extends WebsocketContext<?>> websocketContextImplementationClass, boolean includeCoreModule)
      Returns a module combining all the default plugins implementations.

      The SpincastCoreGuiceModule module is not included.

      Parameters:
      includeCoreModule - Should the Core module being added too?