-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathindex.html.haml
54 lines (43 loc) · 1.39 KB
/
index.html.haml
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
---
layout: home
author: Emmanuel Bernard
title: Jakarta Bean Validation
---
:asciidoc
== What is Jakarta Bean Validation
Jakarta Bean Validation is a Java specification which
- lets you express constraints on object models via annotations
- lets you write custom constraints in an extensible way
- provides the APIs to validate objects and object graphs
- provides the APIs to validate parameters and return values of methods
and constructors
- reports the set of violations (localized)
- runs on Java SE and is integrated in Jakarta EE 9 and 10
[source,java]
----
public class User {
private String email;
@NotNull @Email
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
public class UserService {
public void createUser(@Email String email,
@NotNull String name) {
...
}
}
----
While you can run validation manually, it is more natural to
let other specifications and frameworks validate data at the right
time (user input in presentation frameworks, business service
execution by CDI, entity insert or update by JPA).
In other words, _run once, constrain anywhere_.
.spec-buttons.text-center
%a.ui.button.large.green.right.labeled.icon(href='/3.0/')
%i.icon.arrow.right
Learn more and get the specification...