This content has been marked as final.
Show 5 replies
-
1. Re: Writing a custom converter which wraps EntityConverter
newlukai Jun 15, 2007 3:17 AM (in response to newlukai)Isn't there anyone who's done such an implementation?
-
2. Re: Writing a custom converter which wraps EntityConverter
pmuir Jun 15, 2007 5:36 AM (in response to newlukai)This should be fairly straightforward - just extend the class, copy the annotations (and give it a new name), and delegate as needed.
-
3. Re: Writing a custom converter which wraps EntityConverter
newlukai Jun 15, 2007 10:16 AM (in response to newlukai)Thanks. I've it implemented this way:
public class SeverityConverter implements Converter { public Object getAsObject(FacesContext context, UIComponent component, String value) throws ConverterException { Converter entityConverter = (Converter) Component.getInstance("org.jboss.seam.ui.entityConverter"); if(NoSelectionConverter.NO_SELECTION_VALUE.equals(value)) { return entityConverter.getAsObject(context, component, value); } int severity = Integer.parseInt(value); if(severity >= 0) { return entityConverter.getAsObject(context, component, value); } return AdditionalSeverities.getSeverityByID(severity); } public String getAsString(FacesContext context, UIComponent component, Object value) throws ConverterException { Converter entityConverter = (Converter) Component.getInstance("org.jboss.seam.ui.entityConverter"); Severityclass severity = (Severityclass) value; if(severity == null || severity.getID() >= 0) { return entityConverter.getAsString(context, component, value); } return String.valueOf(severity.getID()); } }
I'm wondering if the way I get the EntityConverter is OK or if there's a more elegant way. -
4. Re: Writing a custom converter which wraps EntityConverter
pmuir Jun 15, 2007 10:21 AM (in response to newlukai)Yes, thats fine :)
-
5. Re: Writing a custom converter which wraps EntityConverter
newlukai Jun 15, 2007 10:24 AM (in response to newlukai)Thanks. Have a nice weekend.