CountViewModel.java
java
1package model; 2 3public class CountViewModel { 4 5 private int followCount; 6 private int followerCount; 7 private int favoriteCount; 8 9 public CountViewModel(int followCount, int followerCount, int favoriteCount) { 10 this.followCount = followCount; 11 this.followerCount = followerCount; 12 this.favoriteCount = favoriteCount; 13 } 14 15 16 public int getFollowCount() {return followCount;} 17 public int getFollowerCount() {return followerCount;} 18 public int getFavoriteCount() {return favoriteCount;} 19 20} 21
CountLogic.java
java
1package model; 2 3import dao.FavoriteDAO; 4import dao.FollowDAO; 5 6public class CountLogic { 7 8 // フォロー数 9 public int executeFollow(int userId) { 10 FollowDAO dao = new FollowDAO(); 11 int followCount = dao.getFollowCount(userId); 12 return followCount; 13 } 14 15 // フォロワー数 16 public int executeFollower(int userId) { 17 FollowDAO dao = new FollowDAO(); 18 int followerCount = dao.getFollowerCount(userId); 19 return followerCount; 20 } 21 22 // お気に入り数 23 public int executeFavoriteCount(int userId) { 24 FavoriteDAO dao = new FavoriteDAO(); 25 int favoriteCount = dao.getFavoriteCount(userId); 26 return favoriteCount; 27 28 } 29 30} 31
CountLogic.javaで
followCount,followerCount, favoriteCount
を
CountViewModel型として一つにまとめたい場合
はどんな風に書けばいいのでしょうか??
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/05/31 02:51 編集
2017/05/31 02:58 編集