All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.objectify.impl.conv.TimeZoneConverter Maven / Gradle / Ivy

Go to download

*** 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;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy