Hi everyone,
Is there any official roadmap for tiger generics support?
If still more than a week away..., any comments on what would be the
preferred way of implementing in Spring framework?
Regards,
Alwyn
Hi everyone,
Is there any official roadmap for tiger generics support?
If still more than a week away..., any comments on what would be the
preferred way of implementing in Spring framework?
Regards,
Alwyn
Spring 1.2RC1 has java 5.0 support, but my guess is that it will take some time to generify Spring because so many developers are using it, and not everyone is allowed to use java 5.0 (there are enough developers forced to use 1.3!)
blog: http://pveentjer.wordpress.com project: STM Implementation http://multiverse.googlecode.com
Well, nothing stops you from using generics in your own components, of course. Spring can nicely populate bean properties of generic collection type, for example.
I guess the main question is: When will Spring [i]itself[/] be using generics, in in its own API? This is certainly not gonna happen in Spring 1.x, where JDK 1.3 compatibility is an important goal - while leveraging JDK 1.4 and 1.5 features when available, of course.
We will have to maintain Spring 1.x for quite a further while: JDK 1.3 will certainly be around till 2006, and JDK 1.4 probably till 2009. To keep maintenance overhead low, we will try to provide as much optional JDK 1.5 value as possible in Spring 1.x.
So eventually, expect Spring 2.0 to build on JDK 1.5, fully leveraging generics :-) However, Spring 2.0 is not even on the horizon yet. I would roughly estimate Spring 2.0 RC1 to be released in mid 2006 - once J2SE 5.0 and also J2EE 5.0 dominate the mainstream.
Juergen
No I was referring to the injection of lists.
I found my problem. I'm migrating an existing framework, created new interfaces to test with, BUT my classes with which I tested still implemented the old interfaces. Quite a personal disappointment.
I am using generics for defining the beans, let's say you have the following generic interface:
interface Entity<E, PK implements Serializable> {
List getAll()
E getById(Pk id);
void delete (E register);
void deleteById(Pk key);
}
let's say you offer a particular implementation, for example for Hibernate
class HibernateEntity<E, PK implements Serializable> implements Entity<E,PK>
extends HibernateSupport
{
...
}
Now on your code you can declare the dao field like this
class Manager {
Entity<Customer, String> customerDao;
and on the application file, you can define the bean like this:
<bean name ="customerDao" class ="HibernateEntity"/>
This works for shure, because I have tested it
Spring will interpret properly that the bean customerDao will be created using the class HibernateEntity for classes Customer and String. This work find thanks to the desing using interfaces like Entity.
It is a good a simple solution for the typical Entity classses that you are going to make the same operations: insert, delete, find, find all, etc.
I don't know if you was asking for the same problem.
Bye,
David