diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2015-09-23 01:02:26 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2015-09-23 01:02:26 +0900 |
commit | b850a97e7b19df6c11c6d45984c79c3070cb606c (patch) | |
tree | e10d639d0850619c97218f58b37c4c5ab7f07044 /app/src/main/java/net/lacolaco/smileessence/entity/Account.java | |
parent | be8fa9c1b0a732659c4501178f651708c6f6dd4a (diff) | |
download | SmileEssence-b850a97e7b19df6c11c6d45984c79c3070cb606c.tar.gz |
Account#getUser() が null を返さないように。とりあえずデータベース上にある screenName を利用する
Diffstat (limited to 'app/src/main/java/net/lacolaco/smileessence/entity/Account.java')
-rw-r--r-- | app/src/main/java/net/lacolaco/smileessence/entity/Account.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/app/src/main/java/net/lacolaco/smileessence/entity/Account.java b/app/src/main/java/net/lacolaco/smileessence/entity/Account.java index 79d6da9f..f78a1317 100644 --- a/app/src/main/java/net/lacolaco/smileessence/entity/Account.java +++ b/app/src/main/java/net/lacolaco/smileessence/entity/Account.java @@ -45,13 +45,13 @@ public class Account extends Model { private User user; @Column(name = "Token", notNull = true) - public String accessToken; + private String accessToken; @Column(name = "Secret", notNull = true) - public String accessSecret; + private String accessSecret; @Column(name = "UserID", notNull = true) - public long userID; - @Deprecated @Column(name = "ScreenName", notNull = true) - public String screenName; + private long userID; + @Column(name = "ScreenName", notNull = true) + private String screenName; // Required by ActiveAndroid public Account() { } @@ -85,11 +85,16 @@ public class Account extends Model { return stream; } - public User getCachedUser() { + // MAY return incomplete object + public User getUser() { if (user == null) { user = User.fetch(userID); // 強い参照をもたせる } - return user; // null かも + if (user == null) { + user = User._makeSkeleton(getUserId(), screenName); + } + + return user; } @Deprecated |