Adding support for generics in generated sources
Brought to you by:
rlogiacco
Can we parametrize the templates to generate code supporting Java 5 generics in case the maven-compiler-plugin is configured to compile against java 1.5 or greater? Actually I saw a few methods in the Domain and Factory classes which can be improved with generalization.
What do you mean for "improved with generalization" ??
Smartweb as u know doesn't use generics , so if i try to parameterize a Domain method as findAll that return a Collection , also I must use a cast to add the object into a raw ArrayList cause BusinessObjectFactory.findBykey return an object and if you try to add an object into a Collection<yourBusinessObject> you must explicit a cast to avoid compile errors.
What I mean is exactly what you are saying, generating code which "supports" generics, performing the casts wherever needed to avoid the user to cast manually and ensuring factories and other methods are used properly.
We can add automagical selection for convertKey so if we have a String primary key we can convert to string, if we have a numeric primary key we can convert to number, we can override the methods and stuff like that.
We can even propose to migrate the core framework to Java 5 if needed