andyhot <[EMAIL PROTECTED]> wrote on 30/10/2006 16:30:08:
> However, Daniel has recently added this in the BeanForm.sourceforge.net
> project.
> See
> http://beanform.sourceforge.net/beanform-
> core/xref/net/sf/beanform/util/EnumPropertySelectionModel.html
>
> or get the beanform jar and add it in your classpath
Efxaristo :)
Interestingly I had arrived at almost the exact same code by the time you
answered. This is the first time I've really used Java 1.5 in a production
environment and I was still struggling to find a way to shorten:
public class EnumPropertySelectionModel<T extends Enum<T>> implements
IPropertySelectionModel {
public EnumPropertySelectionModel(Class<T> type, boolean
includeEmptyOption, Messages messages)
... so that the constructor doesn't need the class passed explicitly.
Surely the wonders of generics should allow such repetition to be made
redundant? I was kind of expecting to be able to use a generic type (T
above) as an instance of java.lang.Class. Unsurprisingly, I can't.
Surprisingly, I can't find a way to work around it! I just spent half a
day worrying about this inelegant solution so seeing that somebody else
seems to have used it did a lot to help me move on to actually writing
some code... but anybody have any ideas?
Maybe this is a bit off-topic, so please tell me to fly off to
comp.lang.java if you must :)
---
This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.