Interface CreationMethodGenerationStrategy
- All Known Implementing Classes:
BuilderCreationMethodStrategy,ConstructorCreationMethodStrategy
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Defines a function that generates a number of methods used to create instances of a generated fixture for a specified
class and the already generated constants of the fixture. Generally for each method generation annotation used on a
class also annotated with
public static returnType methodName() { return returnValue; }
In the above given example, each part is generated according to its own strategy:
Fixture one generation method with the following
structure will be generated:
public static returnType methodName() { return returnValue; }
In the above given example, each part is generated according to its own strategy:
- returnType:
- className in the case of
FixtureConstructor - className.classNameBuilder in the case of
FixtureBuilder
- className in the case of
- methodNamedefined by
FixtureBuilder.methodName()orFixtureConstructor.methodName() - returnValue:
- new className(constructorParameters) in case of
FixtureConstructor - className.builderMethod().setter() in case of
FixtureBuilderwhere there is one setter for eachFixtureBuilder.usedSetters()
- new className(constructorParameters) in case of
-
Method Summary
Modifier and TypeMethodDescriptiongenerateCreationMethods(TypeElement element, ConstantDefinitionMap constantMap, TypeMetadata metadata) Returns aCollectionof allCreationMethods that have been generated for the provided element and constants according to all specified strategies.
-
Method Details
-
generateCreationMethods
Collection<CreationMethod> generateCreationMethods(TypeElement element, ConstantDefinitionMap constantMap, TypeMetadata metadata) Returns aCollectionof allCreationMethods that have been generated for the provided element and constants according to all specified strategies.- Parameters:
element- - for which the creation methods are being generatedconstantMap- - which contains the already generated constants for reference- Returns:
- a
Collectionof generatedCreationMethods
-