/lib/twitter4j-3.0.3/twitter4j-appengine/src/main/java/twitter4j/internal/json/LazyUser.java

https://bitbucket.org/YeahXD/hot6_memory · Java · 439 lines · 219 code · 92 blank · 128 comment · 5 complexity · ce79d0325313eba6b6d9e65ba71847b0 MD5 · raw file

  1. /*
  2. * Copyright 2007 Yusuke Yamamoto
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package twitter4j.internal.json;
  17. import twitter4j.*;
  18. import javax.annotation.Generated;
  19. import java.net.URL;
  20. import java.util.Date;
  21. /**
  22. * A data class representing Basic user information element
  23. *
  24. * @author Yusuke Yamamoto - yusuke at mac.com
  25. */
  26. @Generated(
  27. value = "generate-lazy-objects.sh",
  28. comments = "This is Tool Generated Code. DO NOT EDIT",
  29. date = "2011-07-13"
  30. )
  31. final class LazyUser implements twitter4j.User {
  32. private twitter4j.internal.http.HttpResponse res;
  33. private z_T4JInternalFactory factory;
  34. private User target = null;
  35. LazyUser(twitter4j.internal.http.HttpResponse res, z_T4JInternalFactory factory) {
  36. this.res = res;
  37. this.factory = factory;
  38. }
  39. private User getTarget() {
  40. if (target == null) {
  41. try {
  42. target = factory.createUser(res);
  43. } catch (TwitterException e) {
  44. throw new TwitterRuntimeException(e);
  45. }
  46. }
  47. return target;
  48. }
  49. /**
  50. * Returns the id of the user
  51. *
  52. * @return the id of the user
  53. */
  54. public long getId() {
  55. return getTarget().getId();
  56. }
  57. /**
  58. * Returns the name of the user
  59. *
  60. * @return the name of the user
  61. */
  62. public String getName() {
  63. return getTarget().getName();
  64. }
  65. /**
  66. * Returns the screen name of the user
  67. *
  68. * @return the screen name of the user
  69. */
  70. public String getScreenName() {
  71. return getTarget().getScreenName();
  72. }
  73. /**
  74. * Returns the location of the user
  75. *
  76. * @return the location of the user
  77. */
  78. public String getLocation() {
  79. return getTarget().getLocation();
  80. }
  81. /**
  82. * Returns the description of the user
  83. *
  84. * @return the description of the user
  85. */
  86. public String getDescription() {
  87. return getTarget().getDescription();
  88. }
  89. /**
  90. * Returns URL entities for user description.
  91. *
  92. * @return URL entities for user description
  93. * @since Twitter4J 3.0.3
  94. */
  95. @Override
  96. public URLEntity[] getDescriptionURLEntities() {
  97. return getTarget().getDescriptionURLEntities();
  98. }
  99. /**
  100. * Returns URL entity for user's URL.
  101. *
  102. * @return URL entity for user's URL.
  103. * @since Twitter4J 3.0.3
  104. */
  105. @Override
  106. public URLEntity getURLEntity() {
  107. return getTarget().getURLEntity();
  108. }
  109. /**
  110. * Tests if the user is enabling contributors
  111. *
  112. * @return if the user is enabling contributors
  113. * @since Twitter4J 2.1.2
  114. */
  115. public boolean isContributorsEnabled() {
  116. return getTarget().isContributorsEnabled();
  117. }
  118. /**
  119. * Returns the profile image url of the user
  120. *
  121. * @return the profile image url of the user
  122. */
  123. public String getProfileImageURL() {
  124. return getTarget().getProfileImageURL();
  125. }
  126. @Override
  127. public String getBiggerProfileImageURL() {
  128. return getTarget().getBiggerProfileImageURL();
  129. }
  130. @Override
  131. public String getMiniProfileImageURL() {
  132. return getTarget().getMiniProfileImageURL();
  133. }
  134. @Override
  135. public String getOriginalProfileImageURL() {
  136. return getTarget().getOriginalProfileImageURL();
  137. }
  138. @Override
  139. public URL getProfileImageUrlHttps() {
  140. return getProfileImageUrlHttps();
  141. }
  142. /**
  143. * Returns the profile image url of the user, served over SSL
  144. *
  145. * @return the profile image url of the user, served over SSL
  146. */
  147. public String getProfileImageURLHttps() {
  148. return getTarget().getProfileImageURLHttps();
  149. }
  150. @Override
  151. public String getBiggerProfileImageURLHttps() {
  152. return getTarget().getBiggerProfileImageURLHttps();
  153. }
  154. @Override
  155. public String getMiniProfileImageURLHttps() {
  156. return getTarget().getMiniProfileImageURLHttps();
  157. }
  158. @Override
  159. public String getOriginalProfileImageURLHttps() {
  160. return getTarget().getOriginalProfileImageURLHttps();
  161. }
  162. /**
  163. * Returns the url of the user
  164. *
  165. * @return the url of the user
  166. */
  167. public String getURL() {
  168. return getTarget().getURL();
  169. }
  170. /**
  171. * Test if the user status is protected
  172. *
  173. * @return true if the user status is protected
  174. */
  175. public boolean isProtected() {
  176. return getTarget().isProtected();
  177. }
  178. /**
  179. * Returns the number of followers
  180. *
  181. * @return the number of followers
  182. * @since Twitter4J 1.0.4
  183. */
  184. public int getFollowersCount() {
  185. return getTarget().getFollowersCount();
  186. }
  187. /**
  188. * Returns the current status of the user<br>
  189. * This can be null if the instance if from Status.getUser().
  190. *
  191. * @return current status of the user
  192. * @since Twitter4J 2.1.1
  193. */
  194. public Status getStatus() {
  195. return getTarget().getStatus();
  196. }
  197. public String getProfileBackgroundColor() {
  198. return getTarget().getProfileBackgroundColor();
  199. }
  200. public String getProfileTextColor() {
  201. return getTarget().getProfileTextColor();
  202. }
  203. public String getProfileLinkColor() {
  204. return getTarget().getProfileLinkColor();
  205. }
  206. public String getProfileSidebarFillColor() {
  207. return getTarget().getProfileSidebarFillColor();
  208. }
  209. public String getProfileSidebarBorderColor() {
  210. return getTarget().getProfileSidebarBorderColor();
  211. }
  212. public boolean isProfileUseBackgroundImage() {
  213. return getTarget().isProfileUseBackgroundImage();
  214. }
  215. public boolean isShowAllInlineMedia() {
  216. return getTarget().isShowAllInlineMedia();
  217. }
  218. public int getFriendsCount() {
  219. return getTarget().getFriendsCount();
  220. }
  221. public Date getCreatedAt() {
  222. return getTarget().getCreatedAt();
  223. }
  224. public int getFavouritesCount() {
  225. return getTarget().getFavouritesCount();
  226. }
  227. public int getUtcOffset() {
  228. return getTarget().getUtcOffset();
  229. }
  230. public String getTimeZone() {
  231. return getTarget().getTimeZone();
  232. }
  233. @Override
  234. public String getProfileBackgroundImageUrl() {
  235. return getProfileBackgroundImageURL();
  236. }
  237. public String getProfileBackgroundImageURL() {
  238. return getTarget().getProfileBackgroundImageURL();
  239. }
  240. public String getProfileBackgroundImageUrlHttps() {
  241. return getTarget().getProfileBackgroundImageUrlHttps();
  242. }
  243. public String getProfileBannerURL() {
  244. return getTarget().getProfileBannerURL();
  245. }
  246. @Override
  247. public String getProfileBannerRetinaURL() {
  248. return getTarget().getProfileBannerRetinaURL();
  249. }
  250. @Override
  251. public String getProfileBannerIPadURL() {
  252. return getTarget().getProfileBannerIPadURL();
  253. }
  254. @Override
  255. public String getProfileBannerIPadRetinaURL() {
  256. return getTarget().getProfileBannerIPadRetinaURL();
  257. }
  258. @Override
  259. public String getProfileBannerMobileURL() {
  260. return getTarget().getProfileBannerMobileURL();
  261. }
  262. @Override
  263. public String getProfileBannerMobileRetinaURL() {
  264. return getTarget().getProfileBannerMobileRetinaURL();
  265. }
  266. public boolean isProfileBackgroundTiled() {
  267. return getTarget().isProfileBackgroundTiled();
  268. }
  269. /**
  270. * Returns the preferred language of the user
  271. *
  272. * @return the preferred language of the user
  273. * @since Twitter4J 2.1.2
  274. */
  275. public String getLang() {
  276. return getTarget().getLang();
  277. }
  278. public int getStatusesCount() {
  279. return getTarget().getStatusesCount();
  280. }
  281. /**
  282. * @return the user is enabling geo location
  283. * @since Twitter4J 2.0.10
  284. */
  285. public boolean isGeoEnabled() {
  286. return getTarget().isGeoEnabled();
  287. }
  288. /**
  289. * @return returns true if the user is a verified celebrity
  290. * @since Twitter4J 2.0.10
  291. */
  292. public boolean isVerified() {
  293. return getTarget().isVerified();
  294. }
  295. /**
  296. * @return returns true if the user is a translator
  297. * @since Twitter4J 2.1.9
  298. */
  299. public boolean isTranslator() {
  300. return getTarget().isTranslator();
  301. }
  302. /**
  303. * Returns the number of public lists the user is listed on, or -1
  304. * if the count is unavailable.
  305. *
  306. * @return the number of public lists the user is listed on.
  307. * @since Twitter4J 2.1.4
  308. */
  309. public int getListedCount() {
  310. return getTarget().getListedCount();
  311. }
  312. /**
  313. * Returns true if the authenticating user has requested to follow this user,
  314. * otherwise false.
  315. *
  316. * @return true if the authenticating user has requested to follow this user.
  317. * @since Twitter4J 2.1.4
  318. */
  319. public boolean isFollowRequestSent() {
  320. return getTarget().isFollowRequestSent();
  321. }
  322. public RateLimitStatus getRateLimitStatus() {
  323. return getTarget().getRateLimitStatus();
  324. }
  325. public int getAccessLevel() {
  326. return getTarget().getAccessLevel();
  327. }
  328. public int compareTo(User target) {
  329. return getTarget().compareTo(target);
  330. }
  331. @Override
  332. public boolean equals(Object o) {
  333. if (this == o) return true;
  334. if (!(o instanceof User)) return false;
  335. return getTarget().equals(o);
  336. }
  337. @Override
  338. public int hashCode() {
  339. return getTarget().hashCode();
  340. }
  341. @Override
  342. public String toString() {
  343. return "LazyUser{" +
  344. "target=" + getTarget() +
  345. "}";
  346. }
  347. }