import org.swixml.Attribute;
import org.swixml.Converter;
import org.swixml.Localizer;
import java.util.SimpleTimeZone;
public class TimeZoneConverter implements Converter {
/**
* Convert the value of the given Attribute
object into an output object of the
* specified type.
*
* @param type Class
Data type to which the Attribute's value should be converted
* @param attr Attribute
the attribute, providing the value to be converted.
*
*/
public Object convert(Class type, Attribute attr, Localizer lz) throws Exception {
SimpleTimeZone tz = null;
if (attr != null && attr.getValue() != null) {
tz = new SimpleTimeZone( 0, attr.getValue() );
}
return tz;
}
/**
* A Converters
conversTo method informs about the Class type the converter
* is returning when its convert
method is called
* @return Class
- the Class the converter is returning when its convert method is called
*/
public Class convertsTo() {
return SimpleTimeZone.class;
}
}