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

https://gitlab.com/qt-prometheus/qt-prometheus · Java · 121 lines · 113 code · 4 blank · 4 comment · 26 complexity · 4721c47824af239182d2537a85736299 MD5 · raw file

  1. package com.alibaba.fastjson.parser.deserializer;
  2. import com.alibaba.fastjson.JSON;
  3. import com.alibaba.fastjson.JSONException;
  4. import com.alibaba.fastjson.parser.DefaultJSONParser;
  5. import com.alibaba.fastjson.parser.Feature;
  6. import com.alibaba.fastjson.parser.JSONLexer;
  7. import com.alibaba.fastjson.parser.JSONScanner;
  8. import com.alibaba.fastjson.util.TypeUtils;
  9. import java.lang.reflect.Type;
  10. import java.util.Calendar;
  11. public abstract class AbstractDateDeserializer
  12. implements ObjectDeserializer
  13. {
  14. protected abstract <T> T cast(DefaultJSONParser paramDefaultJSONParser, Type paramType, Object paramObject1, Object paramObject2);
  15. public <T> T deserialze(DefaultJSONParser paramDefaultJSONParser, Type paramType, Object paramObject)
  16. {
  17. JSONLexer localJSONLexer = paramDefaultJSONParser.getLexer();
  18. Object localObject1;
  19. Object localObject3;
  20. if (localJSONLexer.token() == 2)
  21. {
  22. localObject1 = Long.valueOf(localJSONLexer.longValue());
  23. localJSONLexer.nextToken(16);
  24. localObject3 = paramType;
  25. }
  26. while (true)
  27. {
  28. return cast(paramDefaultJSONParser, (Type)localObject3, paramObject, localObject1);
  29. Object localObject2;
  30. if (localJSONLexer.token() == 4)
  31. {
  32. String str = localJSONLexer.stringVal();
  33. localObject2 = str;
  34. localJSONLexer.nextToken(16);
  35. localObject1 = localObject2;
  36. localObject3 = paramType;
  37. if (localJSONLexer.isEnabled(Feature.AllowISO8601DateFormat))
  38. {
  39. localObject3 = new JSONScanner(str);
  40. localObject1 = localObject2;
  41. if (((JSONScanner)localObject3).scanISO8601DateIfMatch())
  42. localObject1 = ((JSONScanner)localObject3).getCalendar().getTime();
  43. ((JSONScanner)localObject3).close();
  44. localObject3 = paramType;
  45. }
  46. }
  47. else if (localJSONLexer.token() == 8)
  48. {
  49. localJSONLexer.nextToken();
  50. localObject1 = null;
  51. localObject3 = paramType;
  52. }
  53. else if (localJSONLexer.token() == 12)
  54. {
  55. localJSONLexer.nextToken();
  56. if (localJSONLexer.token() == 4)
  57. {
  58. localObject1 = localJSONLexer.stringVal();
  59. localObject2 = paramType;
  60. if (JSON.DEFAULT_TYPE_KEY.equals(localObject1))
  61. {
  62. localJSONLexer.nextToken();
  63. paramDefaultJSONParser.accept(17);
  64. localObject1 = TypeUtils.loadClass(localJSONLexer.stringVal());
  65. if (localObject1 != null)
  66. paramType = (Type)localObject1;
  67. paramDefaultJSONParser.accept(4);
  68. paramDefaultJSONParser.accept(16);
  69. localObject2 = paramType;
  70. }
  71. localJSONLexer.nextTokenWithColon(2);
  72. if (localJSONLexer.token() == 2)
  73. {
  74. long l = localJSONLexer.longValue();
  75. localJSONLexer.nextToken();
  76. localObject1 = Long.valueOf(l);
  77. paramDefaultJSONParser.accept(13);
  78. localObject3 = localObject2;
  79. }
  80. }
  81. else
  82. {
  83. throw new JSONException("syntax error");
  84. throw new JSONException("syntax error : " + localJSONLexer.tokenName());
  85. }
  86. }
  87. else if (paramDefaultJSONParser.getResolveStatus() == 2)
  88. {
  89. paramDefaultJSONParser.setResolveStatus(0);
  90. paramDefaultJSONParser.accept(16);
  91. if (localJSONLexer.token() == 4)
  92. {
  93. if (!"val".equals(localJSONLexer.stringVal()))
  94. throw new JSONException("syntax error");
  95. localJSONLexer.nextToken();
  96. paramDefaultJSONParser.accept(17);
  97. localObject1 = paramDefaultJSONParser.parse();
  98. paramDefaultJSONParser.accept(13);
  99. localObject3 = paramType;
  100. }
  101. else
  102. {
  103. throw new JSONException("syntax error");
  104. }
  105. }
  106. else
  107. {
  108. localObject1 = paramDefaultJSONParser.parse();
  109. localObject3 = paramType;
  110. }
  111. }
  112. }
  113. }
  114. /* Location: C:\Users\User\dex2jar-2.0\dex\qting\classes-dex2jar.jar
  115. * Qualified Name: com.alibaba.fastjson.parser.deserializer.AbstractDateDeserializer
  116. * JD-Core Version: 0.6.2
  117. */