| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| LICENSE.txt | 2015-12-14 | 69 Bytes | |
| README.txt | 2015-12-14 | 8.0 kB | |
| strategy-state-generator-1.0.0.jar | 2015-12-14 | 93.6 kB | |
| Totals: 3 Items | 101.6 kB | 0 | |
ÿþ### Description
The Strategy Generator creates Java Source Code for classes representing strategies of strategy type in a half-automated way.
The generated code provides only structures and classes. Concrete methods must be defined manually in the strategy interface and implemented in the strategy classes.
The programmer saves the time to create manually a lot of classes.
### API
The Strategy Generator has the following API class:
- ch.lyrer.walter.generator.strategy.api.IStrategyGenerator
This API class has two methods:
1. setGlobalProperties
2. generateConcreteStrategies
Some Global Properties must be set with method 'setGlobalProperties' before calling the other method.
The method 'generateConcreteStrategies' accepts an instance having type 'GenerateConcreteStrategyIn' as input parameter.
The interesting part of type GenerateConcreteStrategyIn is the property 'List<? extends Enum<?>> strategyConditionValueList'.
This list must be filled with enumeration values of an enumeration. It is assumed that each enumeration value represents
a strategy. Thus it is expected that such an enumeration exists or is created before the generator is invoked.
### Features
There are some features to mention with the Strategy-Generator:
1. The generated code can have one of two ways of integration you can choose from:
SINGLETON_BY_PATTERN:
Strategy classes are generated following the Singleton Pattern.
The Strategy Factory can be accessed via IStrategyFactory.FACTORY constant.
SINGLETON_BY_SPRING_DI_ON_ANNOTATION:
Converter classes are generated using Spring Dependency
Injection with annotations @Component and @Autowired.
2. The method generateConcreteStrategies returns a result object. The result object contains information
which classes are created and which not due to already existing files.
### Design of Generated code
The Strategy Generator provides a design structure. There is a strategy factory interface and implementation:
- I{strategyName}StrategyFactory
- {strategyName}StrategyFactoryImpl
The strategies themselves have an interface, an abstract class and all required strategy classes.
- I{strategyName}Strategy
- Abstract{strategyName}StrategyFactory
- {strategyName}{strategyCondition[1]}Strategy
- ...
- {strategyName}{strategyCondition[n]}Strategy
### Generation Rules
1. Packages and directories are not created. They must already exist. Otherwise generation fails.
2. No existing Java Source Code is overwritten. When you need this then you must delete the
appropriate files before.
You can lookup which files are generated or not in the result object of the generation methods.
### Using the generated strategies
All strategies can be accessed via the strategy factory. Depending on the chosen integration type the
strategy factory must be accessed differently.
1. Integration Type SINGLETON_BY_PATTERN:
The Strategy Factory must be accessed via the interface constant I{strategyName}StrategyFactory.FACTORY.
2. Integration Type SINGLETON_BY_SPRING_DI_ON_ANNOTATION:
The Strategy Factory must be accessed via Spring DI on interface I{strategyName}StrategyFactory.
### License
Apache License 2.0
### Disclaimer
The author cannot be made responsible for any damage caused by the Strategy-Generator.
The usage of the Strategy-Generator is on own risk.
The code is designed and implemented on best know-how and with good intension by the author.
Especially is to mention that the generated code of the Strategy-Generator is not guaranteed to run instantly correct.
Manual supervision is necessary and crucial.
### Author
Walter Lyrer
#### Other projects from same author
[Converter Generator](https://sourceforge.net/projects/convertergenerator/)
[Named Parameter Converter](https://sourceforge.net/projects/namedparameterconverter/)