CacheControl$Builder.smali 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. .class public final Lokhttp3/CacheControl$Builder;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # annotations
  5. .annotation system Ldalvik/annotation/EnclosingClass;
  6. value = Lokhttp3/CacheControl;
  7. .end annotation
  8. .annotation system Ldalvik/annotation/InnerClass;
  9. accessFlags = 0x19
  10. name = "Builder"
  11. .end annotation
  12. # instance fields
  13. .field immutable:Z
  14. .field maxAgeSeconds:I
  15. .field maxStaleSeconds:I
  16. .field minFreshSeconds:I
  17. .field noCache:Z
  18. .field noStore:Z
  19. .field noTransform:Z
  20. .field onlyIfCached:Z
  21. # direct methods
  22. .method public constructor <init>()V
  23. .locals 1
  24. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  25. const/4 v0, -0x1
  26. iput v0, p0, Lokhttp3/CacheControl$Builder;->maxAgeSeconds:I
  27. iput v0, p0, Lokhttp3/CacheControl$Builder;->maxStaleSeconds:I
  28. iput v0, p0, Lokhttp3/CacheControl$Builder;->minFreshSeconds:I
  29. return-void
  30. .end method
  31. # virtual methods
  32. .method public build()Lokhttp3/CacheControl;
  33. .locals 1
  34. new-instance v0, Lokhttp3/CacheControl;
  35. invoke-direct {v0, p0}, Lokhttp3/CacheControl;-><init>(Lokhttp3/CacheControl$Builder;)V
  36. return-object v0
  37. .end method
  38. .method public immutable()Lokhttp3/CacheControl$Builder;
  39. .locals 1
  40. const/4 v0, 0x1
  41. iput-boolean v0, p0, Lokhttp3/CacheControl$Builder;->immutable:Z
  42. return-object p0
  43. .end method
  44. .method public maxAge(ILjava/util/concurrent/TimeUnit;)Lokhttp3/CacheControl$Builder;
  45. .locals 3
  46. if-ltz p1, :cond_1
  47. int-to-long v0, p1
  48. invoke-virtual {p2, v0, v1}, Ljava/util/concurrent/TimeUnit;->toSeconds(J)J
  49. move-result-wide p1
  50. const-wide/32 v0, 0x7fffffff
  51. cmp-long v2, p1, v0
  52. if-lez v2, :cond_0
  53. const p1, 0x7fffffff
  54. goto :goto_0
  55. :cond_0
  56. long-to-int p1, p1
  57. :goto_0
  58. iput p1, p0, Lokhttp3/CacheControl$Builder;->maxAgeSeconds:I
  59. return-object p0
  60. :cond_1
  61. new-instance p2, Ljava/lang/IllegalArgumentException;
  62. new-instance v0, Ljava/lang/StringBuilder;
  63. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  64. const-string v1, "maxAge < 0: "
  65. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  66. invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
  67. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  68. move-result-object p1
  69. invoke-direct {p2, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  70. throw p2
  71. .end method
  72. .method public maxStale(ILjava/util/concurrent/TimeUnit;)Lokhttp3/CacheControl$Builder;
  73. .locals 3
  74. if-ltz p1, :cond_1
  75. int-to-long v0, p1
  76. invoke-virtual {p2, v0, v1}, Ljava/util/concurrent/TimeUnit;->toSeconds(J)J
  77. move-result-wide p1
  78. const-wide/32 v0, 0x7fffffff
  79. cmp-long v2, p1, v0
  80. if-lez v2, :cond_0
  81. const p1, 0x7fffffff
  82. goto :goto_0
  83. :cond_0
  84. long-to-int p1, p1
  85. :goto_0
  86. iput p1, p0, Lokhttp3/CacheControl$Builder;->maxStaleSeconds:I
  87. return-object p0
  88. :cond_1
  89. new-instance p2, Ljava/lang/IllegalArgumentException;
  90. new-instance v0, Ljava/lang/StringBuilder;
  91. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  92. const-string v1, "maxStale < 0: "
  93. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  94. invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
  95. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  96. move-result-object p1
  97. invoke-direct {p2, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  98. throw p2
  99. .end method
  100. .method public minFresh(ILjava/util/concurrent/TimeUnit;)Lokhttp3/CacheControl$Builder;
  101. .locals 3
  102. if-ltz p1, :cond_1
  103. int-to-long v0, p1
  104. invoke-virtual {p2, v0, v1}, Ljava/util/concurrent/TimeUnit;->toSeconds(J)J
  105. move-result-wide p1
  106. const-wide/32 v0, 0x7fffffff
  107. cmp-long v2, p1, v0
  108. if-lez v2, :cond_0
  109. const p1, 0x7fffffff
  110. goto :goto_0
  111. :cond_0
  112. long-to-int p1, p1
  113. :goto_0
  114. iput p1, p0, Lokhttp3/CacheControl$Builder;->minFreshSeconds:I
  115. return-object p0
  116. :cond_1
  117. new-instance p2, Ljava/lang/IllegalArgumentException;
  118. new-instance v0, Ljava/lang/StringBuilder;
  119. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  120. const-string v1, "minFresh < 0: "
  121. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  122. invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
  123. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  124. move-result-object p1
  125. invoke-direct {p2, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  126. throw p2
  127. .end method
  128. .method public noCache()Lokhttp3/CacheControl$Builder;
  129. .locals 1
  130. const/4 v0, 0x1
  131. iput-boolean v0, p0, Lokhttp3/CacheControl$Builder;->noCache:Z
  132. return-object p0
  133. .end method
  134. .method public noStore()Lokhttp3/CacheControl$Builder;
  135. .locals 1
  136. const/4 v0, 0x1
  137. iput-boolean v0, p0, Lokhttp3/CacheControl$Builder;->noStore:Z
  138. return-object p0
  139. .end method
  140. .method public noTransform()Lokhttp3/CacheControl$Builder;
  141. .locals 1
  142. const/4 v0, 0x1
  143. iput-boolean v0, p0, Lokhttp3/CacheControl$Builder;->noTransform:Z
  144. return-object p0
  145. .end method
  146. .method public onlyIfCached()Lokhttp3/CacheControl$Builder;
  147. .locals 1
  148. const/4 v0, 0x1
  149. iput-boolean v0, p0, Lokhttp3/CacheControl$Builder;->onlyIfCached:Z
  150. return-object p0
  151. .end method