forked from NeilAlishev/SpringCourse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPerson.java
More file actions
78 lines (59 loc) · 1.65 KB
/
Person.java
File metadata and controls
78 lines (59 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package ru.alishev.springcourse.models;
import javax.validation.constraints.*;
/**
* @author Neil Alishev
*/
public class Person {
private int id;
@NotEmpty(message = "Name should not be empty")
@Size(min = 2, max = 30, message = "Name should be between 2 and 30 characters")
private String name;
@Min(value = 0, message = "Age should be greater than 0")
private int age;
@NotEmpty(message = "Email should not be empty")
@Email(message = "Email should be valid")
private String email;
// Страна, Город, Индекс (6 цифр)
// Russia, Moscow, 123456
@Pattern(regexp = "[A-Z]\\w+, [A-Z]\\w+, \\d{6}", message = "Your address should be in this format: Country, City, Postal Code (6 digits)")
private String address;
public Person() {
}
public Person(int id, String name, int age, String email, String address) {
this.id = id;
this.name = name;
this.age = age;
this.email = email;
this.address = address;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}