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