1 
2 import org.swixml.Attribute;
3 import org.swixml.Converter;
4 import org.swixml.Localizer;
5 
6 import java.util.SimpleTimeZone;
7 
8 
9 public class TimeZoneConverter implements Converter {
10  /**
11   * Convert the value of the given <code>Attribute</code> object into an output object of the
12   * specified type.
13   *
14   * @param type <code>Class</code> Data type to which the Attribute's value should be converted
15   * @param attr <code>Attribute</code> the attribute, providing the value to be converted.
16   *
17   */
18  public Object convert(Class type, Attribute attr, Localizer lz) throws Exception {
19    SimpleTimeZone tz = null;
20    if (attr != null && attr.getValue() != null) {
21      tz = new SimpleTimeZone( 0, attr.getValue() );
22    }
23    return tz;
24  }
25
26  /**
27   * A <code>Converters</code> conversTo method informs about the Class type the converter
28   * is returning when its <code>convert</code> method is called
29   * @return <code>Class</code> - the Class the converter is returning when its convert method is called
30   */
31  public Class convertsTo() {
32    return SimpleTimeZone.class;
33  }
34}
35