Android Open Source - EnklawaPlayer Date Deserializer

From Project

Back to project page EnklawaPlayer.


The source code is released under:

GNU General Public License

If you think the Android project EnklawaPlayer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package macbury.pod.extensions;
/*w  w  w  . ja  v a  2 s.  co  m*/

import java.lang.reflect.Type;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

 * Created by macbury on 10.09.14.
public class DateDeserializer implements JsonDeserializer<Date> {
  private final SimpleDateFormat dateFormat;

  public DateDeserializer() {
    dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
  public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    try {
      return dateFormat.parse(json.getAsString());
    } catch (ParseException e) {
      return null;

Java Source Code List