Ok. have been digging a bit further on this subject and got things working by hacking the current code a bit. But i wonder if their is more to this then i first thought.
Let see if i can relay my findings a bit. I have special enumerations which relate to database stored values, each enumeration is tagged with a interface named 'DatabaseEnum'.
For these enumeration i have created a special custom converter called DatabaseEnumConverter, which has a FacesConverter annotation attached to it.
Code: Select all
@FacesConverter(forClass = DatabaseEnum.class)
public class DatabaseEnumConverter implements Converter, PartialStateHolder {
The InputRenderer class seems to happily ignore this class, since it basically says to itself.. Enum, ok i know how to handle this myself. But in my case the values are stored in the so called FlashScope and when retrieving them from this scope the enums are just given back as String values.... Which is not what i expect, i expected a enum back
To fix this issue i added a few lines of code the the InputRenderer mentioned above (Based on SVN revision 5798):
Code: Select all
if(object instanceof SelectItem) {
selectItems.add((SelectItem) object);
}
else if(object instanceof Enum) {
Enum e = (Enum) object;
// Check if a converter is available, use it if so and register it to the component for correct decoding as well.
Converter converter = context.getApplication().createConverter(object.getClass());
if (converter != null) {
component.setConverter(converter);
itemValue = getOptionAsString(context, component, converter, object);
}
selectItems.add(new SelectItem(itemValue == null ? e.name() : itemValue, itemLabel == null ? e.name() : itemLabel, description, disabled, escaped, noSelectionOption));
}
else{
selectItems.add(new SelectItem(itemValue == null ? object : itemValue, itemLabel == null ? object.toString() : itemLabel, description, disabled, escaped, noSelectionOption));
}
Now the converter is taking into account and the values in the flash scope, are the actual enumeration values i expected. But this makes me wonder, are more converters ignored? Especially worried about the ones which are defined with a @FacesConverter(forClass=....) annotation?