public static User createModel(UserBean userBean) { User user = new User(); user.setUserName(userBean.getUserName()); user.setUserAge(userBean.getUserAge()); user.setUserGender(userBean.getUserGender()); user.setUserJobType(userBean.getUserJob()); user.setUserHobbies(convertArrayToCsv(userBean.getUserHobbies())); return user; }
public static List<UserBean> createUserBeanList(List<User> users) { List<UserBean> beans = new ArrayList<UserBean>(); UserBean userBean = null; for (User user : users) { userBean = new UserBean(); userBean.setUserName(user.getUserName()); userBean.setUserAge(user.getUserAge()); userBean.setUserGender(user.getUserGender()); userBean.setUserJob(user.getUserJobType()); userBean.setUserHobbies(convertCsvToArr(user.getUserHobbies())); beans.add(userBean); } return beans; }