Back to project page geocamMemoForAndroid.
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 geocamMemoForAndroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package gov.nasa.arc.geocam.memo.service; //from ww w . j ava2 s .c om 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; } }