Back to project page geocamMemoAndroid.
The source code is released under:
NASA OPEN SOURCE AGREEMENT VERSION 1.3 THIS OPEN SOURCE AGREEMENT ("AGREEMENT") DEFINES THE RIGHTS OF USE, REPRODUCTION, DISTRIBUTION, MODIFICATION AND REDISTRIBUTION OF CERTAIN COMPUTER SOFTWARE ORI...
If you think the Android project geocamMemoAndroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
// __BEGIN_LICENSE__ // Copyright (C) 2008-2010 United States Government as represented by // the Administrator of the National Aeronautics and Space Administration. // All Rights Reserved. // __END_LICENSE__ //from w ww . ja va 2 s . c o m package gov.nasa.arc.geocam.memo.service; import gov.nasa.arc.geocam.memo.bean.GeoCamMemoMessage; import java.lang.reflect.Type; import java.util.List; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; /** * The Class DjangoMemoJsonConverterImplementation. This class * provides the methods that manipulate the data into and from * the Json string */ public class DjangoMemoJsonConverterImplementation implements DjangoMemoJsonConverterInterface { /* (non-Javadoc) * @see gov.nasa.arc.geocam.memo.service.DjangoMemoJsonConverterInterface#deserializeList(java.lang.String) */ @Override public List<GeoCamMemoMessage> deserializeList(String jsonString) { GsonBuilder builder = new GsonBuilder(); builder.setDateFormat("MM/dd/yy HH:mm:ss"); Gson gson = builder.create(); Type listType = new TypeToken<List<GeoCamMemoMessage>>(){}.getType(); return gson.fromJson(jsonString, listType); } /* (non-Javadoc) * @see gov.nasa.arc.geocam.memo.service.DjangoMemoJsonConverterInterface#deserialize(java.lang.String) */ public GeoCamMemoMessage deserialize(String jsonString) { GsonBuilder builder = new GsonBuilder(); builder.setDateFormat("MM/dd/yy HH:mm:ss"); Gson gson = builder.create(); return gson.fromJson(jsonString, GeoCamMemoMessage.class); } /* (non-Javadoc) * @see gov.nasa.arc.geocam.memo.service.DjangoMemoJsonConverterInterface#serialize(gov.nasa.arc.geocam.memo.bean.GeoCamMemoMessage) */ @Override public String serialize(GeoCamMemoMessage message) { GsonBuilder builder = new GsonBuilder(); builder.setDateFormat("MM/dd/yy HH:mm:ss"); Gson gson = builder.create(); String ret= gson.toJson(message); return ret; } }