FieldNamingPolicy.smali 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. .class public abstract enum Lcom/google/gson/FieldNamingPolicy;
  2. .super Ljava/lang/Enum;
  3. .source ""
  4. # interfaces
  5. .implements Lcom/google/gson/FieldNamingStrategy;
  6. # annotations
  7. .annotation system Ldalvik/annotation/Signature;
  8. value = {
  9. "Ljava/lang/Enum<",
  10. "Lcom/google/gson/FieldNamingPolicy;",
  11. ">;",
  12. "Lcom/google/gson/FieldNamingStrategy;"
  13. }
  14. .end annotation
  15. # static fields
  16. .field private static final synthetic $VALUES:[Lcom/google/gson/FieldNamingPolicy;
  17. .field public static final enum IDENTITY:Lcom/google/gson/FieldNamingPolicy;
  18. .field public static final enum LOWER_CASE_WITH_DASHES:Lcom/google/gson/FieldNamingPolicy;
  19. .field public static final enum LOWER_CASE_WITH_UNDERSCORES:Lcom/google/gson/FieldNamingPolicy;
  20. .field public static final enum UPPER_CAMEL_CASE:Lcom/google/gson/FieldNamingPolicy;
  21. .field public static final enum UPPER_CAMEL_CASE_WITH_SPACES:Lcom/google/gson/FieldNamingPolicy;
  22. # direct methods
  23. .method static constructor <clinit>()V
  24. .locals 7
  25. new-instance v0, Lcom/google/gson/FieldNamingPolicy$1;
  26. const/4 v1, 0x0
  27. const-string v2, "IDENTITY"
  28. invoke-direct {v0, v2, v1}, Lcom/google/gson/FieldNamingPolicy$1;-><init>(Ljava/lang/String;I)V
  29. sput-object v0, Lcom/google/gson/FieldNamingPolicy;->IDENTITY:Lcom/google/gson/FieldNamingPolicy;
  30. new-instance v0, Lcom/google/gson/FieldNamingPolicy$2;
  31. const/4 v2, 0x1
  32. const-string v3, "UPPER_CAMEL_CASE"
  33. invoke-direct {v0, v3, v2}, Lcom/google/gson/FieldNamingPolicy$2;-><init>(Ljava/lang/String;I)V
  34. sput-object v0, Lcom/google/gson/FieldNamingPolicy;->UPPER_CAMEL_CASE:Lcom/google/gson/FieldNamingPolicy;
  35. new-instance v0, Lcom/google/gson/FieldNamingPolicy$3;
  36. const/4 v3, 0x2
  37. const-string v4, "UPPER_CAMEL_CASE_WITH_SPACES"
  38. invoke-direct {v0, v4, v3}, Lcom/google/gson/FieldNamingPolicy$3;-><init>(Ljava/lang/String;I)V
  39. sput-object v0, Lcom/google/gson/FieldNamingPolicy;->UPPER_CAMEL_CASE_WITH_SPACES:Lcom/google/gson/FieldNamingPolicy;
  40. new-instance v0, Lcom/google/gson/FieldNamingPolicy$4;
  41. const/4 v4, 0x3
  42. const-string v5, "LOWER_CASE_WITH_UNDERSCORES"
  43. invoke-direct {v0, v5, v4}, Lcom/google/gson/FieldNamingPolicy$4;-><init>(Ljava/lang/String;I)V
  44. sput-object v0, Lcom/google/gson/FieldNamingPolicy;->LOWER_CASE_WITH_UNDERSCORES:Lcom/google/gson/FieldNamingPolicy;
  45. new-instance v0, Lcom/google/gson/FieldNamingPolicy$5;
  46. const/4 v5, 0x4
  47. const-string v6, "LOWER_CASE_WITH_DASHES"
  48. invoke-direct {v0, v6, v5}, Lcom/google/gson/FieldNamingPolicy$5;-><init>(Ljava/lang/String;I)V
  49. sput-object v0, Lcom/google/gson/FieldNamingPolicy;->LOWER_CASE_WITH_DASHES:Lcom/google/gson/FieldNamingPolicy;
  50. const/4 v0, 0x5
  51. new-array v0, v0, [Lcom/google/gson/FieldNamingPolicy;
  52. sget-object v6, Lcom/google/gson/FieldNamingPolicy;->IDENTITY:Lcom/google/gson/FieldNamingPolicy;
  53. aput-object v6, v0, v1
  54. sget-object v1, Lcom/google/gson/FieldNamingPolicy;->UPPER_CAMEL_CASE:Lcom/google/gson/FieldNamingPolicy;
  55. aput-object v1, v0, v2
  56. sget-object v1, Lcom/google/gson/FieldNamingPolicy;->UPPER_CAMEL_CASE_WITH_SPACES:Lcom/google/gson/FieldNamingPolicy;
  57. aput-object v1, v0, v3
  58. sget-object v1, Lcom/google/gson/FieldNamingPolicy;->LOWER_CASE_WITH_UNDERSCORES:Lcom/google/gson/FieldNamingPolicy;
  59. aput-object v1, v0, v4
  60. sget-object v1, Lcom/google/gson/FieldNamingPolicy;->LOWER_CASE_WITH_DASHES:Lcom/google/gson/FieldNamingPolicy;
  61. aput-object v1, v0, v5
  62. sput-object v0, Lcom/google/gson/FieldNamingPolicy;->$VALUES:[Lcom/google/gson/FieldNamingPolicy;
  63. return-void
  64. .end method
  65. .method private constructor <init>(Ljava/lang/String;I)V
  66. .locals 0
  67. .annotation system Ldalvik/annotation/Signature;
  68. value = {
  69. "()V"
  70. }
  71. .end annotation
  72. invoke-direct {p0, p1, p2}, Ljava/lang/Enum;-><init>(Ljava/lang/String;I)V
  73. return-void
  74. .end method
  75. .method synthetic constructor <init>(Ljava/lang/String;ILcom/google/gson/FieldNamingPolicy$1;)V
  76. .locals 0
  77. invoke-direct {p0, p1, p2}, Lcom/google/gson/FieldNamingPolicy;-><init>(Ljava/lang/String;I)V
  78. return-void
  79. .end method
  80. .method private static modifyString(CLjava/lang/String;I)Ljava/lang/String;
  81. .locals 1
  82. invoke-virtual {p1}, Ljava/lang/String;->length()I
  83. move-result v0
  84. if-ge p2, v0, :cond_0
  85. new-instance v0, Ljava/lang/StringBuilder;
  86. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  87. invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
  88. invoke-virtual {p1, p2}, Ljava/lang/String;->substring(I)Ljava/lang/String;
  89. move-result-object p0
  90. invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  91. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  92. move-result-object p0
  93. goto :goto_0
  94. :cond_0
  95. invoke-static {p0}, Ljava/lang/String;->valueOf(C)Ljava/lang/String;
  96. move-result-object p0
  97. :goto_0
  98. return-object p0
  99. .end method
  100. .method static separateCamelCase(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
  101. .locals 5
  102. new-instance v0, Ljava/lang/StringBuilder;
  103. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  104. invoke-virtual {p0}, Ljava/lang/String;->length()I
  105. move-result v1
  106. const/4 v2, 0x0
  107. :goto_0
  108. if-ge v2, v1, :cond_1
  109. invoke-virtual {p0, v2}, Ljava/lang/String;->charAt(I)C
  110. move-result v3
  111. invoke-static {v3}, Ljava/lang/Character;->isUpperCase(C)Z
  112. move-result v4
  113. if-eqz v4, :cond_0
  114. invoke-virtual {v0}, Ljava/lang/StringBuilder;->length()I
  115. move-result v4
  116. if-eqz v4, :cond_0
  117. invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  118. :cond_0
  119. invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
  120. add-int/lit8 v2, v2, 0x1
  121. goto :goto_0
  122. :cond_1
  123. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  124. move-result-object p0
  125. return-object p0
  126. .end method
  127. .method static upperCaseFirstLetter(Ljava/lang/String;)Ljava/lang/String;
  128. .locals 5
  129. new-instance v0, Ljava/lang/StringBuilder;
  130. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  131. const/4 v1, 0x0
  132. invoke-virtual {p0, v1}, Ljava/lang/String;->charAt(I)C
  133. move-result v2
  134. invoke-virtual {p0}, Ljava/lang/String;->length()I
  135. move-result v3
  136. :goto_0
  137. add-int/lit8 v4, v3, -0x1
  138. if-ge v1, v4, :cond_1
  139. invoke-static {v2}, Ljava/lang/Character;->isLetter(C)Z
  140. move-result v4
  141. if-eqz v4, :cond_0
  142. goto :goto_1
  143. :cond_0
  144. invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
  145. add-int/lit8 v1, v1, 0x1
  146. invoke-virtual {p0, v1}, Ljava/lang/String;->charAt(I)C
  147. move-result v2
  148. goto :goto_0
  149. :cond_1
  150. :goto_1
  151. invoke-static {v2}, Ljava/lang/Character;->isUpperCase(C)Z
  152. move-result v3
  153. if-nez v3, :cond_2
  154. invoke-static {v2}, Ljava/lang/Character;->toUpperCase(C)C
  155. move-result v2
  156. add-int/lit8 v1, v1, 0x1
  157. invoke-static {v2, p0, v1}, Lcom/google/gson/FieldNamingPolicy;->modifyString(CLjava/lang/String;I)Ljava/lang/String;
  158. move-result-object p0
  159. invoke-virtual {v0, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  160. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  161. move-result-object p0
  162. :cond_2
  163. return-object p0
  164. .end method
  165. .method public static valueOf(Ljava/lang/String;)Lcom/google/gson/FieldNamingPolicy;
  166. .locals 1
  167. const-class v0, Lcom/google/gson/FieldNamingPolicy;
  168. invoke-static {v0, p0}, Ljava/lang/Enum;->valueOf(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;
  169. move-result-object p0
  170. check-cast p0, Lcom/google/gson/FieldNamingPolicy;
  171. return-object p0
  172. .end method
  173. .method public static values()[Lcom/google/gson/FieldNamingPolicy;
  174. .locals 1
  175. sget-object v0, Lcom/google/gson/FieldNamingPolicy;->$VALUES:[Lcom/google/gson/FieldNamingPolicy;
  176. invoke-virtual {v0}, [Lcom/google/gson/FieldNamingPolicy;->clone()Ljava/lang/Object;
  177. move-result-object v0
  178. check-cast v0, [Lcom/google/gson/FieldNamingPolicy;
  179. return-object v0
  180. .end method