PageRenderTime 48ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://gitlab.com/qt-prometheus/qt-prometheus
Java | 99 lines | 90 code | 5 blank | 4 comment | 18 complexity | b6f25dfe1c209485c8fa5334a8d98982 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 java.awt.Color;
  6. import java.lang.reflect.Type;
  7. public class ColorDeserializer
  8. implements ObjectDeserializer
  9. {
  10. public static final ColorDeserializer instance = new ColorDeserializer();
  11. public <T> T deserialze(DefaultJSONParser paramDefaultJSONParser, Type paramType, Object paramObject)
  12. {
  13. paramDefaultJSONParser = paramDefaultJSONParser.getLexer();
  14. if ((paramDefaultJSONParser.token() != 12) && (paramDefaultJSONParser.token() != 16))
  15. throw new JSONException("syntax error");
  16. paramDefaultJSONParser.nextToken();
  17. int j = 0;
  18. int k = 0;
  19. int m = 0;
  20. int n = 0;
  21. if (paramDefaultJSONParser.token() == 13)
  22. {
  23. paramDefaultJSONParser.nextToken();
  24. return new Color(j, k, m, n);
  25. }
  26. int i;
  27. int i3;
  28. int i2;
  29. int i1;
  30. if (paramDefaultJSONParser.token() == 4)
  31. {
  32. paramType = paramDefaultJSONParser.stringVal();
  33. paramDefaultJSONParser.nextTokenWithColon(2);
  34. if (paramDefaultJSONParser.token() != 2)
  35. break label224;
  36. i = paramDefaultJSONParser.intValue();
  37. paramDefaultJSONParser.nextToken();
  38. if (!paramType.equalsIgnoreCase("r"))
  39. break label234;
  40. i3 = i;
  41. i2 = k;
  42. i1 = m;
  43. i = n;
  44. }
  45. while (true)
  46. {
  47. n = i;
  48. m = i1;
  49. k = i2;
  50. j = i3;
  51. if (paramDefaultJSONParser.token() != 16)
  52. break;
  53. paramDefaultJSONParser.nextToken(4);
  54. n = i;
  55. m = i1;
  56. k = i2;
  57. j = i3;
  58. break;
  59. throw new JSONException("syntax error");
  60. label224: throw new JSONException("syntax error");
  61. label234: if (paramType.equalsIgnoreCase("g"))
  62. {
  63. i2 = i;
  64. i = n;
  65. i1 = m;
  66. i3 = j;
  67. }
  68. else if (paramType.equalsIgnoreCase("b"))
  69. {
  70. i1 = i;
  71. i = n;
  72. i2 = k;
  73. i3 = j;
  74. }
  75. else
  76. {
  77. if (!paramType.equalsIgnoreCase("alpha"))
  78. break label314;
  79. i1 = m;
  80. i2 = k;
  81. i3 = j;
  82. }
  83. }
  84. label314: throw new JSONException("syntax error, " + paramType);
  85. }
  86. public int getFastMatchToken()
  87. {
  88. return 12;
  89. }
  90. }
  91. /* Location: C:\Users\User\dex2jar-2.0\dex\qting\classes-dex2jar.jar
  92. * Qualified Name: com.alibaba.fastjson.parser.deserializer.ColorDeserializer
  93. * JD-Core Version: 0.6.2
  94. */