TimeTypeAdapter.smali 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. .class public final Lcom/google/gson/internal/bind/TimeTypeAdapter;
  2. .super Lcom/google/gson/TypeAdapter;
  3. .source ""
  4. # annotations
  5. .annotation system Ldalvik/annotation/Signature;
  6. value = {
  7. "Lcom/google/gson/TypeAdapter<",
  8. "Ljava/sql/Time;",
  9. ">;"
  10. }
  11. .end annotation
  12. # static fields
  13. .field public static final FACTORY:Lcom/google/gson/TypeAdapterFactory;
  14. # instance fields
  15. .field private final format:Ljava/text/DateFormat;
  16. # direct methods
  17. .method static constructor <clinit>()V
  18. .locals 1
  19. new-instance v0, Lcom/google/gson/internal/bind/TimeTypeAdapter$1;
  20. invoke-direct {v0}, Lcom/google/gson/internal/bind/TimeTypeAdapter$1;-><init>()V
  21. sput-object v0, Lcom/google/gson/internal/bind/TimeTypeAdapter;->FACTORY:Lcom/google/gson/TypeAdapterFactory;
  22. return-void
  23. .end method
  24. .method public constructor <init>()V
  25. .locals 2
  26. invoke-direct {p0}, Lcom/google/gson/TypeAdapter;-><init>()V
  27. new-instance v0, Ljava/text/SimpleDateFormat;
  28. const-string v1, "hh:mm:ss a"
  29. invoke-direct {v0, v1}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;)V
  30. iput-object v0, p0, Lcom/google/gson/internal/bind/TimeTypeAdapter;->format:Ljava/text/DateFormat;
  31. return-void
  32. .end method
  33. # virtual methods
  34. .method public bridge synthetic read(Lcom/google/gson/stream/JsonReader;)Ljava/lang/Object;
  35. .locals 0
  36. .annotation system Ldalvik/annotation/Throws;
  37. value = {
  38. Ljava/io/IOException;
  39. }
  40. .end annotation
  41. invoke-virtual {p0, p1}, Lcom/google/gson/internal/bind/TimeTypeAdapter;->read(Lcom/google/gson/stream/JsonReader;)Ljava/sql/Time;
  42. move-result-object p1
  43. return-object p1
  44. .end method
  45. .method public declared-synchronized read(Lcom/google/gson/stream/JsonReader;)Ljava/sql/Time;
  46. .locals 3
  47. .annotation system Ldalvik/annotation/Throws;
  48. value = {
  49. Ljava/io/IOException;
  50. }
  51. .end annotation
  52. monitor-enter p0
  53. :try_start_0
  54. invoke-virtual {p1}, Lcom/google/gson/stream/JsonReader;->peek()Lcom/google/gson/stream/JsonToken;
  55. move-result-object v0
  56. sget-object v1, Lcom/google/gson/stream/JsonToken;->NULL:Lcom/google/gson/stream/JsonToken;
  57. if-ne v0, v1, :cond_0
  58. invoke-virtual {p1}, Lcom/google/gson/stream/JsonReader;->nextNull()V
  59. :try_end_0
  60. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  61. const/4 p1, 0x0
  62. monitor-exit p0
  63. return-object p1
  64. :cond_0
  65. :try_start_1
  66. iget-object v0, p0, Lcom/google/gson/internal/bind/TimeTypeAdapter;->format:Ljava/text/DateFormat;
  67. invoke-virtual {p1}, Lcom/google/gson/stream/JsonReader;->nextString()Ljava/lang/String;
  68. move-result-object p1
  69. invoke-virtual {v0, p1}, Ljava/text/DateFormat;->parse(Ljava/lang/String;)Ljava/util/Date;
  70. move-result-object p1
  71. new-instance v0, Ljava/sql/Time;
  72. invoke-virtual {p1}, Ljava/util/Date;->getTime()J
  73. move-result-wide v1
  74. invoke-direct {v0, v1, v2}, Ljava/sql/Time;-><init>(J)V
  75. :try_end_1
  76. .catch Ljava/text/ParseException; {:try_start_1 .. :try_end_1} :catch_0
  77. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  78. monitor-exit p0
  79. return-object v0
  80. :catch_0
  81. move-exception p1
  82. :try_start_2
  83. new-instance v0, Lcom/google/gson/JsonSyntaxException;
  84. invoke-direct {v0, p1}, Lcom/google/gson/JsonSyntaxException;-><init>(Ljava/lang/Throwable;)V
  85. throw v0
  86. :try_end_2
  87. .catchall {:try_start_2 .. :try_end_2} :catchall_0
  88. :catchall_0
  89. move-exception p1
  90. monitor-exit p0
  91. throw p1
  92. .end method
  93. .method public bridge synthetic write(Lcom/google/gson/stream/JsonWriter;Ljava/lang/Object;)V
  94. .locals 0
  95. .annotation system Ldalvik/annotation/Throws;
  96. value = {
  97. Ljava/io/IOException;
  98. }
  99. .end annotation
  100. check-cast p2, Ljava/sql/Time;
  101. invoke-virtual {p0, p1, p2}, Lcom/google/gson/internal/bind/TimeTypeAdapter;->write(Lcom/google/gson/stream/JsonWriter;Ljava/sql/Time;)V
  102. return-void
  103. .end method
  104. .method public declared-synchronized write(Lcom/google/gson/stream/JsonWriter;Ljava/sql/Time;)V
  105. .locals 1
  106. .annotation system Ldalvik/annotation/Throws;
  107. value = {
  108. Ljava/io/IOException;
  109. }
  110. .end annotation
  111. monitor-enter p0
  112. if-nez p2, :cond_0
  113. const/4 p2, 0x0
  114. goto :goto_0
  115. :cond_0
  116. :try_start_0
  117. iget-object v0, p0, Lcom/google/gson/internal/bind/TimeTypeAdapter;->format:Ljava/text/DateFormat;
  118. invoke-virtual {v0, p2}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
  119. move-result-object p2
  120. :goto_0
  121. invoke-virtual {p1, p2}, Lcom/google/gson/stream/JsonWriter;->value(Ljava/lang/String;)Lcom/google/gson/stream/JsonWriter;
  122. :try_end_0
  123. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  124. monitor-exit p0
  125. return-void
  126. :catchall_0
  127. move-exception p1
  128. monitor-exit p0
  129. throw p1
  130. .end method