01: package org.obe.worklist;
02:
03: import javax.faces.component.UIComponent;
04: import javax.faces.context.FacesContext;
05: import javax.faces.convert.Converter;
06: import java.io.Serializable;
07:
08: /**
09: * Converts objects to/from non-null strings.
10: *
11: * @author Adrian Price
12: */
13: public class StringConverter implements Converter, Serializable {
14: private static final long serialVersionUID = 545113577714637932L;
15:
16: public StringConverter() {
17: }
18:
19: public Object getAsObject(FacesContext context,
20: UIComponent component, String value) {
21:
22: return value == null || value.equals(" ") ? null : value;
23: }
24:
25: public String getAsString(FacesContext context,
26: UIComponent component, Object value) {
27:
28: return WorklistUtils.convert(value);
29: }
30: }
|