Class ConstantGenerationStrategy
java.lang.Object
de.floydkretschmar.fixturize.stategies.constants.ConstantGenerationStrategy
The strategy used to generate constants for a given fixture. Generally for each field in a given class that is
annotated with
public static tupe constantName = constantValue;
In the above given example, each part is generated according to its own strategy:
Fixture one constant with the following format is generated:
public static tupe constantName = constantValue;
In the above given example, each part is generated according to its own strategy:
- type: The same type as field
- constantName:
- the name of field according to the specified
ConstantsNamingStrategy - or the name specified by
FixtureConstant
- the name of field according to the specified
- constantValue:
- one of the default
ValueProviders specified for the type of field - or a custom value provider specified by
FixtureValueProvider - or the value specified by
FixtureConstant
- one of the default
When field is annotated with one or more FixtureConstant annotations, then one constant per annotation
is generated.
-
Constructor Summary
ConstructorsConstructorDescriptionConstantGenerationStrategy(ConstantsNamingStrategy constantsNamingStrategy, ValueProviderService valueProviderService, Elements elementUtils) -
Method Summary
Modifier and TypeMethodDescriptiongenerateConstants(TypeElement element, TypeMetadata metadata) Returns aConstantDefinitionMapcontaining allConstants that have been generated for the provided element according to all specified strategies.
-
Constructor Details
-
ConstantGenerationStrategy
public ConstantGenerationStrategy(ConstantsNamingStrategy constantsNamingStrategy, ValueProviderService valueProviderService, Elements elementUtils)
-
-
Method Details
-
generateConstants
Returns aConstantDefinitionMapcontaining allConstants that have been generated for the provided element according to all specified strategies.- Parameters:
element- - for which the constants will be generated- Returns:
- the
ConstantDefinitionMapcontaining all constant definitions
-