Reformatting code of javaxval before starting on [BAEL-3306]
This commit is contained in:
parent
0ba79b88b4
commit
76e0fe4642
@ -10,10 +10,10 @@ import javax.validation.constraints.PositiveOrZero;
|
|||||||
|
|
||||||
public class Customer {
|
public class Customer {
|
||||||
|
|
||||||
@NotBlank(message="Name cannot be empty")
|
@NotBlank(message = "Name cannot be empty")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
private List<@NotBlank(message="Address must not be blank") String> addresses;
|
private List<@NotBlank(message = "Address must not be blank") String> addresses;
|
||||||
|
|
||||||
private Integer age;
|
private Integer age;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import javax.validation.constraints.NotNull;
|
|||||||
|
|
||||||
public class CustomerMap {
|
public class CustomerMap {
|
||||||
|
|
||||||
private Map<@Email(message="Must be a valid email") String, @NotNull Customer> customers;
|
private Map<@Email(message = "Must be a valid email") String, @NotNull Customer> customers;
|
||||||
|
|
||||||
public Map<String, Customer> getCustomers() {
|
public Map<String, Customer> getCustomers() {
|
||||||
return customers;
|
return customers;
|
||||||
|
@ -6,7 +6,7 @@ import org.baeldung.javabeanconstraints.entities.UserNotBlank;
|
|||||||
|
|
||||||
public class Application {
|
public class Application {
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) {
|
||||||
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
|
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
|
||||||
UserNotBlank user = new UserNotBlank(" ");
|
UserNotBlank user = new UserNotBlank(" ");
|
||||||
validator.validate(user).stream().forEach(violation -> System.out.println(violation.getMessage()));
|
validator.validate(user).stream().forEach(violation -> System.out.println(violation.getMessage()));
|
||||||
|
@ -8,7 +8,7 @@ import javax.validation.constraints.Digits;
|
|||||||
public class Invoice {
|
public class Invoice {
|
||||||
|
|
||||||
@DecimalMin(value = "0.0", inclusive = false)
|
@DecimalMin(value = "0.0", inclusive = false)
|
||||||
@Digits(integer=3, fraction=2)
|
@Digits(integer = 3, fraction = 2)
|
||||||
private BigDecimal price;
|
private BigDecimal price;
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ public class RegistrationForm {
|
|||||||
@NotBlank(groups = BasicInfo.class)
|
@NotBlank(groups = BasicInfo.class)
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
@NotBlank(groups = { BasicInfo.class, AdvanceInfo.class })
|
@NotBlank(groups = {BasicInfo.class, AdvanceInfo.class})
|
||||||
private String captcha;
|
private String captcha;
|
||||||
|
|
||||||
@NotBlank(groups = AdvanceInfo.class)
|
@NotBlank(groups = AdvanceInfo.class)
|
||||||
|
@ -8,10 +8,10 @@ import javax.validation.constraints.AssertTrue;
|
|||||||
import javax.validation.constraints.Email;
|
import javax.validation.constraints.Email;
|
||||||
import javax.validation.constraints.Max;
|
import javax.validation.constraints.Max;
|
||||||
import javax.validation.constraints.Min;
|
import javax.validation.constraints.Min;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import javax.validation.constraints.Past;
|
import javax.validation.constraints.Past;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
|
|
||||||
public class User {
|
public class User {
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ public class User {
|
|||||||
@Email(message = "Email should be valid")
|
@Email(message = "Email should be valid")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
List<@NotBlank String> preferences;
|
private List<@NotBlank String> preferences;
|
||||||
|
|
||||||
private LocalDate dateOfBirth;
|
private LocalDate dateOfBirth;
|
||||||
|
|
||||||
@ -90,5 +90,4 @@ public class User {
|
|||||||
public void setPreferences(List<String> preferences) {
|
public void setPreferences(List<String> preferences) {
|
||||||
this.preferences = preferences;
|
this.preferences = preferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user