Skip to content

Validation

Regunath B edited this page Jul 19, 2018 · 5 revisions

Validation

Hibernate Validator is packaged with GJEX using the guice-validator library.

Field Validations

Individual field can be validated using javax.validation annotations like below:

@NotBlank
private String greeting;
@NotNull
private Integer age;
public HelloBean() {
}

Complete Source

Method argument Validations

Method arguments can be validated like below:

public void sayHello(@NotNull @Valid HelloBean helloBean) {
....
}

Complete Source

See guice-validator for more examples