/QingTingFanBianYi/src/com/alibaba/fastjson/parser/deserializer/TimeDeserializer.java

https://gitlab.com/qt-prometheus/qt-prometheus · Java · 71 lines · 62 code · 5 blank · 4 comment · 17 complexity · 233f69a7a89e6c5721103ec9c3067088 MD5 · raw file

  1. package com.alibaba.fastjson.parser.deserializer;
  2. import com.alibaba.fastjson.JSONException;
  3. import com.alibaba.fastjson.parser.DefaultJSONParser;
  4. import com.alibaba.fastjson.parser.JSONLexer;
  5. import com.alibaba.fastjson.parser.JSONScanner;
  6. import java.lang.reflect.Type;
  7. import java.sql.Time;
  8. import java.util.Calendar;
  9. public class TimeDeserializer
  10. implements ObjectDeserializer
  11. {
  12. public static final TimeDeserializer instance = new TimeDeserializer();
  13. public <T> T deserialze(DefaultJSONParser paramDefaultJSONParser, Type paramType, Object paramObject)
  14. {
  15. paramType = paramDefaultJSONParser.getLexer();
  16. long l;
  17. if (paramType.token() == 16)
  18. {
  19. paramType.nextToken(4);
  20. if (paramType.token() != 4)
  21. throw new JSONException("syntax error");
  22. paramType.nextTokenWithColon(2);
  23. if (paramType.token() != 2)
  24. throw new JSONException("syntax error");
  25. l = paramType.longValue();
  26. paramType.nextToken(13);
  27. if (paramType.token() != 13)
  28. throw new JSONException("syntax error");
  29. paramType.nextToken(16);
  30. paramDefaultJSONParser = new Time(l);
  31. }
  32. do
  33. {
  34. return paramDefaultJSONParser;
  35. paramType = paramDefaultJSONParser.parse();
  36. if (paramType == null)
  37. return null;
  38. paramDefaultJSONParser = paramType;
  39. }
  40. while ((paramType instanceof Time));
  41. if ((paramType instanceof Number))
  42. return new Time(((Number)paramType).longValue());
  43. if ((paramType instanceof String))
  44. {
  45. paramDefaultJSONParser = (String)paramType;
  46. if (paramDefaultJSONParser.length() == 0)
  47. return null;
  48. paramType = new JSONScanner(paramDefaultJSONParser);
  49. if (paramType.scanISO8601DateIfMatch());
  50. for (l = paramType.getCalendar().getTimeInMillis(); ; l = Long.parseLong(paramDefaultJSONParser))
  51. {
  52. paramType.close();
  53. return new Time(l);
  54. }
  55. }
  56. throw new JSONException("parse error");
  57. }
  58. public int getFastMatchToken()
  59. {
  60. return 2;
  61. }
  62. }
  63. /* Location: C:\Users\User\dex2jar-2.0\dex\qting\classes-dex2jar.jar
  64. * Qualified Name: com.alibaba.fastjson.parser.deserializer.TimeDeserializer
  65. * JD-Core Version: 0.6.2
  66. */