コード例 #1
0
ファイル: Customer.java プロジェクト: dilgerma/Ks-Video-Store
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((adress == null) ? 0 : adress.hashCode());
   result = prime * result + ((email == null) ? 0 : email.hashCode());
   result = prime * result + ((name == null) ? 0 : name.hashCode());
   result = prime * result + ((type == null) ? 0 : type.hashCode());
   return result;
 }
コード例 #2
0
ファイル: addUser.java プロジェクト: smallgaben/Admin_Panel
 public User createUser(HttpServletRequest req) {
   User user = new User();
   Set<MusicType> musicTypes = new HashSet<>();
   String[] musics = req.getParameterValues("musicTypes");
   for (int i = 0; i < musics.length; i++) {
     musicTypes.add(new MusicTypeDAOImp().read(Integer.valueOf(musics[i])));
   }
   Adress adress = new Adress();
   adress.setCountry(req.getParameter("country"));
   adress.setStreet(req.getParameter("street"));
   adress.setIndex(Integer.valueOf(req.getParameter("zip")));
   user.setLogin(req.getParameter("login"));
   user.setPassword(req.getParameter("password"));
   user.setFistName(req.getParameter("firstName"));
   user.setLastName(req.getParameter("lastName"));
   user.setAdress(adress);
   user.setRole(new RoleDAOImp().getDefaultRole());
   user.setMusicTypes(musicTypes);
   return user;
 }
コード例 #3
0
ファイル: Customer.java プロジェクト: dilgerma/Ks-Video-Store
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   Customer other = (Customer) obj;
   if (adress == null) {
     if (other.adress != null) return false;
   } else if (!adress.equals(other.adress)) return false;
   if (email == null) {
     if (other.email != null) return false;
   } else if (!email.equals(other.email)) return false;
   if (name == null) {
     if (other.name != null) return false;
   } else if (!name.equals(other.name)) return false;
   if (type != other.type) return false;
   return true;
 }