Primitives.smali 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. .class public final Lcom/google/gson/internal/Primitives;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # static fields
  5. .field private static final PRIMITIVE_TO_WRAPPER_TYPE:Ljava/util/Map;
  6. .annotation system Ldalvik/annotation/Signature;
  7. value = {
  8. "Ljava/util/Map<",
  9. "Ljava/lang/Class<",
  10. "*>;",
  11. "Ljava/lang/Class<",
  12. "*>;>;"
  13. }
  14. .end annotation
  15. .end field
  16. .field private static final WRAPPER_TO_PRIMITIVE_TYPE:Ljava/util/Map;
  17. .annotation system Ldalvik/annotation/Signature;
  18. value = {
  19. "Ljava/util/Map<",
  20. "Ljava/lang/Class<",
  21. "*>;",
  22. "Ljava/lang/Class<",
  23. "*>;>;"
  24. }
  25. .end annotation
  26. .end field
  27. # direct methods
  28. .method static constructor <clinit>()V
  29. .locals 4
  30. new-instance v0, Ljava/util/HashMap;
  31. const/16 v1, 0x10
  32. invoke-direct {v0, v1}, Ljava/util/HashMap;-><init>(I)V
  33. new-instance v2, Ljava/util/HashMap;
  34. invoke-direct {v2, v1}, Ljava/util/HashMap;-><init>(I)V
  35. sget-object v1, Ljava/lang/Boolean;->TYPE:Ljava/lang/Class;
  36. const-class v3, Ljava/lang/Boolean;
  37. invoke-static {v0, v2, v1, v3}, Lcom/google/gson/internal/Primitives;->add(Ljava/util/Map;Ljava/util/Map;Ljava/lang/Class;Ljava/lang/Class;)V
  38. sget-object v1, Ljava/lang/Byte;->TYPE:Ljava/lang/Class;
  39. const-class v3, Ljava/lang/Byte;
  40. invoke-static {v0, v2, v1, v3}, Lcom/google/gson/internal/Primitives;->add(Ljava/util/Map;Ljava/util/Map;Ljava/lang/Class;Ljava/lang/Class;)V
  41. sget-object v1, Ljava/lang/Character;->TYPE:Ljava/lang/Class;
  42. const-class v3, Ljava/lang/Character;
  43. invoke-static {v0, v2, v1, v3}, Lcom/google/gson/internal/Primitives;->add(Ljava/util/Map;Ljava/util/Map;Ljava/lang/Class;Ljava/lang/Class;)V
  44. sget-object v1, Ljava/lang/Double;->TYPE:Ljava/lang/Class;
  45. const-class v3, Ljava/lang/Double;
  46. invoke-static {v0, v2, v1, v3}, Lcom/google/gson/internal/Primitives;->add(Ljava/util/Map;Ljava/util/Map;Ljava/lang/Class;Ljava/lang/Class;)V
  47. sget-object v1, Ljava/lang/Float;->TYPE:Ljava/lang/Class;
  48. const-class v3, Ljava/lang/Float;
  49. invoke-static {v0, v2, v1, v3}, Lcom/google/gson/internal/Primitives;->add(Ljava/util/Map;Ljava/util/Map;Ljava/lang/Class;Ljava/lang/Class;)V
  50. sget-object v1, Ljava/lang/Integer;->TYPE:Ljava/lang/Class;
  51. const-class v3, Ljava/lang/Integer;
  52. invoke-static {v0, v2, v1, v3}, Lcom/google/gson/internal/Primitives;->add(Ljava/util/Map;Ljava/util/Map;Ljava/lang/Class;Ljava/lang/Class;)V
  53. sget-object v1, Ljava/lang/Long;->TYPE:Ljava/lang/Class;
  54. const-class v3, Ljava/lang/Long;
  55. invoke-static {v0, v2, v1, v3}, Lcom/google/gson/internal/Primitives;->add(Ljava/util/Map;Ljava/util/Map;Ljava/lang/Class;Ljava/lang/Class;)V
  56. sget-object v1, Ljava/lang/Short;->TYPE:Ljava/lang/Class;
  57. const-class v3, Ljava/lang/Short;
  58. invoke-static {v0, v2, v1, v3}, Lcom/google/gson/internal/Primitives;->add(Ljava/util/Map;Ljava/util/Map;Ljava/lang/Class;Ljava/lang/Class;)V
  59. sget-object v1, Ljava/lang/Void;->TYPE:Ljava/lang/Class;
  60. const-class v3, Ljava/lang/Void;
  61. invoke-static {v0, v2, v1, v3}, Lcom/google/gson/internal/Primitives;->add(Ljava/util/Map;Ljava/util/Map;Ljava/lang/Class;Ljava/lang/Class;)V
  62. invoke-static {v0}, Ljava/util/Collections;->unmodifiableMap(Ljava/util/Map;)Ljava/util/Map;
  63. move-result-object v0
  64. sput-object v0, Lcom/google/gson/internal/Primitives;->PRIMITIVE_TO_WRAPPER_TYPE:Ljava/util/Map;
  65. invoke-static {v2}, Ljava/util/Collections;->unmodifiableMap(Ljava/util/Map;)Ljava/util/Map;
  66. move-result-object v0
  67. sput-object v0, Lcom/google/gson/internal/Primitives;->WRAPPER_TO_PRIMITIVE_TYPE:Ljava/util/Map;
  68. return-void
  69. .end method
  70. .method private constructor <init>()V
  71. .locals 1
  72. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  73. new-instance v0, Ljava/lang/UnsupportedOperationException;
  74. invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;-><init>()V
  75. throw v0
  76. .end method
  77. .method private static add(Ljava/util/Map;Ljava/util/Map;Ljava/lang/Class;Ljava/lang/Class;)V
  78. .locals 0
  79. .annotation system Ldalvik/annotation/Signature;
  80. value = {
  81. "(",
  82. "Ljava/util/Map<",
  83. "Ljava/lang/Class<",
  84. "*>;",
  85. "Ljava/lang/Class<",
  86. "*>;>;",
  87. "Ljava/util/Map<",
  88. "Ljava/lang/Class<",
  89. "*>;",
  90. "Ljava/lang/Class<",
  91. "*>;>;",
  92. "Ljava/lang/Class<",
  93. "*>;",
  94. "Ljava/lang/Class<",
  95. "*>;)V"
  96. }
  97. .end annotation
  98. invoke-interface {p0, p2, p3}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
  99. invoke-interface {p1, p3, p2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
  100. return-void
  101. .end method
  102. .method public static isPrimitive(Ljava/lang/reflect/Type;)Z
  103. .locals 1
  104. sget-object v0, Lcom/google/gson/internal/Primitives;->PRIMITIVE_TO_WRAPPER_TYPE:Ljava/util/Map;
  105. invoke-interface {v0, p0}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
  106. move-result p0
  107. return p0
  108. .end method
  109. .method public static isWrapperType(Ljava/lang/reflect/Type;)Z
  110. .locals 1
  111. sget-object v0, Lcom/google/gson/internal/Primitives;->WRAPPER_TO_PRIMITIVE_TYPE:Ljava/util/Map;
  112. invoke-static {p0}, Lcom/google/gson/internal/$Gson$Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
  113. move-result-object p0
  114. invoke-interface {v0, p0}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
  115. move-result p0
  116. return p0
  117. .end method
  118. .method public static unwrap(Ljava/lang/Class;)Ljava/lang/Class;
  119. .locals 2
  120. .annotation system Ldalvik/annotation/Signature;
  121. value = {
  122. "<T:",
  123. "Ljava/lang/Object;",
  124. ">(",
  125. "Ljava/lang/Class<",
  126. "TT;>;)",
  127. "Ljava/lang/Class<",
  128. "TT;>;"
  129. }
  130. .end annotation
  131. sget-object v0, Lcom/google/gson/internal/Primitives;->WRAPPER_TO_PRIMITIVE_TYPE:Ljava/util/Map;
  132. invoke-static {p0}, Lcom/google/gson/internal/$Gson$Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
  133. move-result-object v1
  134. invoke-interface {v0, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
  135. move-result-object v0
  136. check-cast v0, Ljava/lang/Class;
  137. if-nez v0, :cond_0
  138. goto :goto_0
  139. :cond_0
  140. move-object p0, v0
  141. :goto_0
  142. return-object p0
  143. .end method
  144. .method public static wrap(Ljava/lang/Class;)Ljava/lang/Class;
  145. .locals 2
  146. .annotation system Ldalvik/annotation/Signature;
  147. value = {
  148. "<T:",
  149. "Ljava/lang/Object;",
  150. ">(",
  151. "Ljava/lang/Class<",
  152. "TT;>;)",
  153. "Ljava/lang/Class<",
  154. "TT;>;"
  155. }
  156. .end annotation
  157. sget-object v0, Lcom/google/gson/internal/Primitives;->PRIMITIVE_TO_WRAPPER_TYPE:Ljava/util/Map;
  158. invoke-static {p0}, Lcom/google/gson/internal/$Gson$Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
  159. move-result-object v1
  160. invoke-interface {v0, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
  161. move-result-object v0
  162. check-cast v0, Ljava/lang/Class;
  163. if-nez v0, :cond_0
  164. goto :goto_0
  165. :cond_0
  166. move-object p0, v0
  167. :goto_0
  168. return-object p0
  169. .end method