public interface DependencyInjectionHelper
Modifier and Type | Method and Description |
---|---|
MethodSpec |
generateConstructor(SpecModel specModel)
Generate the constructor required for Dependency Injection.
|
CodeBlock |
generateFactoryMethodsComponentInstance(SpecModel specModel)
Generate the code needed to inject a new instance of the given SpecModel called 'instance'
|
String |
generateImplAccessor(SpecModel specModel,
MethodParamModel methodParamModel)
Generate accessor code for each injected field.
|
TypeSpecDataHolder |
generateInjectedFields(SpecModel specModel,
ImmutableList<InjectPropModel> injectPropParams)
Generate the necessary code to handle the
InjectProp
annotation. |
MethodSpec |
generateTestingFieldAccessor(SpecModel specModel,
InjectPropModel injectPropModel)
Generate an accessor for each injected field.
|
ImmutableList<AnnotationSpec> |
getAdditionalClassAnnotations(SpecModel specModel)
Returns a list of additional annotations to add to the generated component class
|
boolean |
isValidGeneratedComponentAnnotation(AnnotationSpec annotation)
Whether a Spec annotation should be moved to the generated Component.
|
List<SpecModelValidationError> |
validate(SpecModel specModel)
Validate that the dependency injection for this spec is correctly defined.
|
List<SpecModelValidationError> validate(SpecModel specModel)
boolean isValidGeneratedComponentAnnotation(AnnotationSpec annotation)
ImmutableList<AnnotationSpec> getAdditionalClassAnnotations(SpecModel specModel)
MethodSpec generateConstructor(SpecModel specModel)
CodeBlock generateFactoryMethodsComponentInstance(SpecModel specModel)
TypeSpecDataHolder generateInjectedFields(SpecModel specModel, ImmutableList<InjectPropModel> injectPropParams)
InjectProp
annotation. Field with the same name of the parameter should be returned to be usable.specModel
- the model holding the spec being generatedinjectPropParams
- a list of the models for the injected paramsMethodSpec generateTestingFieldAccessor(SpecModel specModel, InjectPropModel injectPropModel)
String generateImplAccessor(SpecModel specModel, MethodParamModel methodParamModel)
specModel
- the model holding the spc being generatedmethodParamModel
- the model for the method parameter being accessed