// Path: src/main/java/com/yyqian/imagine/dto/UserCreateForm.java
// public class UserCreateForm {
// 
//   @NotEmpty
//   private String username = "";
// 
//   @NotEmpty
//   private String password = "";
// 
//   @NotEmpty
//   private String passwordRepeated = "";
// 
//   public UserCreateForm() {
//   }
// 
//   public String getUsername() {
//     return username;
//   }
// 
//   public void setUsername(String username) {
//     this.username = username.trim();
//   }
// 
//   public String getPassword() {
//     return password;
//   }
// 
//   public void setPassword(String password) {
//     this.password = password.trim();
//   }
// 
//   public String getPasswordRepeated() {
//     return passwordRepeated;
//   }
// 
//   public void setPasswordRepeated(String passwordRepeated) {
//     this.passwordRepeated = passwordRepeated.trim();
//   }
// 
// }
// 
// Path: src/main/java/com/yyqian/imagine/service/UserService.java
// public interface UserService {
// 
//   Optional<User> getUserById(long id);
// 
//   Optional<User> getUserByUsername(String username);
// 
//   Collection<User> getAllUsers();
// 
//   User create(UserCreateForm form);
// 
//   int increasePointByUserId(Long id);
// 
//   User update(UserUpdateForm form);
// 
//   User resetPassword(PasswordRestForm form);
// 
//   void sendRestPasswordEmail(String username);
// 
//   void authUserByToken(String token);
// 
// }


import com.yyqian.imagine.dto.UserCreateForm;
import com.yyqian.imagine.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;
package com.yyqian.imagine.dto.validator;


/**
 * Created by yyqian on 12/15/15.
 */
@Component
public class UserCreateFormValidator implements Validator {

  private static final int MINIMUM_USERNAME_LENGTH = 3;
  private static final int MINIMUM_PASSWORD_LENGTH = 6;
// Path: src/main/java/com/yyqian/imagine/dto/UserCreateForm.java
// public class UserCreateForm {
// 
//   @NotEmpty
//   private String username = "";
// 
//   @NotEmpty
//   private String password = "";
// 
//   @NotEmpty
//   private String passwordRepeated = "";
// 
//   public UserCreateForm() {
//   }
// 
//   public String getUsername() {
//     return username;
//   }
// 
//   public void setUsername(String username) {
//     this.username = username.trim();
//   }
// 
//   public String getPassword() {
//     return password;
//   }
// 
//   public void setPassword(String password) {
//     this.password = password.trim();
//   }
// 
//   public String getPasswordRepeated() {
//     return passwordRepeated;
//   }
// 
//   public void setPasswordRepeated(String passwordRepeated) {
//     this.passwordRepeated = passwordRepeated.trim();
//   }
// 
// }
// 
// Path: src/main/java/com/yyqian/imagine/service/UserService.java
// public interface UserService {
// 
//   Optional<User> getUserById(long id);
// 
//   Optional<User> getUserByUsername(String username);
// 
//   Collection<User> getAllUsers();
// 
//   User create(UserCreateForm form);
// 
//   int increasePointByUserId(Long id);
// 
//   User update(UserUpdateForm form);
// 
//   User resetPassword(PasswordRestForm form);
// 
//   void sendRestPasswordEmail(String username);
// 
//   void authUserByToken(String token);
// 
// }


// Path: src/main/java/com/yyqian/imagine/dto/validator/UserCreateFormValidator.java
import com.yyqian.imagine.dto.UserCreateForm;
import com.yyqian.imagine.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

package com.yyqian.imagine.dto.validator;


/**
 * Created by yyqian on 12/15/15.
 */
@Component
public class UserCreateFormValidator implements Validator {

  private static final int MINIMUM_USERNAME_LENGTH = 3;
  private static final int MINIMUM_PASSWORD_LENGTH = 6;
  private final UserService userService;