Hibernate validator example



package nl.kameroom.user;

import java.util.Date;

import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;

public class BasicRegister {

	private int idAuthority;

	@Email (message = "2.email.format")
        @Length(min=1, max = 100, message="3.email.length") 
	private String email;

        @Length(min=1, max = 100, message="5.pass.length")  
	private String password;

        @Length(min=1, max = 100, message="7.firstname.length") 
	private String firstname;

        @Length(min=1, max = 100, message="9.lastname.length") 
	private String lastname;

        @Length(min= 1, max = 1, message="11.gender.length") 
	private String gender;

	public int getIdAuthority() {
		return idAuthority;
	}
	public void setIdAuthority(int idAuthority) {
		this.idAuthority = idAuthority;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getFirstname() {
		return firstname;
	}

	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}

	public String getLastname() {
		return lastname;
	}

	public void setLastname(String lastname) {
		this.lastname = lastname;
	}

        public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s