Class GuiceChainrInstantiator

java.lang.Object
com.bazaarvoice.jolt.chainr.instantiator.GuiceChainrInstantiator
All Implemented Interfaces:
ChainrInstantiator

public class GuiceChainrInstantiator extends Object implements ChainrInstantiator
This class allows Transforms specified in Chainr spec files to be loaded via Guice. This is primarily used for Custom Java Transforms that need additional information.

It requires a GuiceModule, because it creates an Injector for each SpecTransform it processes.

If your app is using Guice, you can either pass in your "existing" Module (if you can), or create a Guice Module with just the dependencies that the Transforms require. The latter approach keeps scope contained, and make it easier to unit test your Transforms.

Note this does require that you "know" what Transforms you are using and what they depend on.

  • Field Details

    • parentModule

      private final com.google.inject.Module parentModule
    • nonSpecInjector

      private final com.google.inject.Injector nonSpecInjector
  • Constructor Details

    • GuiceChainrInstantiator

      public GuiceChainrInstantiator(com.google.inject.Module parentModule)
      Parameters:
      parentModule - Guice module that will be used to create an injector to instantiate Transform classes
  • Method Details