You can use a validation constraint to ensure that the values of fields, methods, and types are valid and within a specified constraint. You apply a validation constraint by placing annotations on a field, method, or class, for example on a managed bean or persistent entity class.
You can use the validation constraints that are defined as part of the Bean Validation API or create custom constraints by specifying the constraints for the field or property and the annotation that is associated with the custom constraints. You can specify the constraints in the validation constraint class or create a validator class for the constraint.
For additional details about bean validation and a list of the predefined constraints, see the following document.
You use the New Validation Constraint wizard to generate a custom validation constraint class. You can select the Generate Validator Class option in the wizard if you want the IDE to also generate a constraint validator class for the validation constraint.
You open the wizard by opening the New File wizard and selecting Validation Constraint in the Bean Validation category.
In the Name and Location page you set the following properties:
If you select this option you need to supply the following details for the generated class.