Class GuiceChainrInstantiator
java.lang.Object
com.bazaarvoice.jolt.chainr.instantiator.GuiceChainrInstantiator
- All Implemented Interfaces:
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 Summary
FieldsModifier and TypeFieldDescriptionprivate final com.google.inject.Injector
private final com.google.inject.Module
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionhydrateTransform
(ChainrEntry entry) Instantiate the Transform class specified by the ChainrEntry.
-
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
-
hydrateTransform
Description copied from interface:ChainrInstantiator
Instantiate the Transform class specified by the ChainrEntry.- Specified by:
hydrateTransform
in interfaceChainrInstantiator
-