public Object unmarshall(SerializerState state, Class clazz, Object o)
      throws UnmarshallException
  {
    JSONObject jso = (JSONObject) o;
    long time;
    try
    {
      time = jso.getLong("time");
    }
    catch(JSONException e)
    {
      throw new UnmarshallException("Could not get the time in date serialiser", e);
    }
    if (jso.has("javaClass"))
    {
      try
      {
        clazz = Class.forName(jso.getString("javaClass"));
      }
      catch (ClassNotFoundException e)
      {
        throw new UnmarshallException(e.getMessage(), e);
      }
      catch(JSONException e)
      {
        throw new UnmarshallException("Could not find javaClass", e);
      }
    }
    Object returnValue = null;
    if (Date.class.equals(clazz))
    {
      returnValue = new Date(time);
    }
    else if (Timestamp.class.equals(clazz))
    {
      returnValue = new Timestamp(time);
    }
    else if (java.sql.Date.class.equals(clazz))
    {
      returnValue = new java.sql.Date(time);
    }
    else if (java.sql.Time.class.equals(clazz))
    {
      returnValue = new Time(time);
    }
    if (returnValue == null)
    {
      throw new UnmarshallException("invalid class " + clazz);
    }
    state.setSerialized(o, returnValue);
    return returnValue;
   }