com.googlecode.objectify.impl.conv.TimeZoneConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of objectify Show documentation
Show all versions of objectify Show documentation
*** THIS VERSION UPLOADED FOR USE WITH CEDAR-COMMON, TO AVOID DEPENDENCIES ON GOOGLE CODE-BASED MAVEN REPOSITORIES. *** The simplest convenient interface to the Google App Engine datastore
The newest version!
package com.googlecode.objectify.impl.conv;
import java.util.TimeZone;
/**
* Converts java.util.TimeZone
*/
public class TimeZoneConverter implements Converter
{
@Override
public Object forDatastore(Object value, ConverterSaveContext ctx)
{
if (value instanceof TimeZone)
return ((TimeZone)value).getID();
else
return null;
}
@Override
public Object forPojo(Object value, Class fieldType, ConverterLoadContext ctx, Object onPojo)
{
if (value instanceof String && fieldType == TimeZone.class)
return TimeZone.getTimeZone((String)value);
else
return null;
}
}