<commit_before>// Bean Validation
//
// License: Apache License, Version 2.0
// See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.

[[builtinconstraints]]

== Built-in Constraint definitions

The specification defines a small set of built-in constraints. Their usage is encouraged both in regular constraint declarations and as composing constraints. Using this set of constraints will enhance portability of your constraints across constraint-consuming frameworks relying on the metadata API (such as client side validation frameworks or database schema generation frameworks).

Built-in annotations are annotated with an empty [classname]`@Constraint` annotation to avoid any dependency between the specification API and a specific implementation. [tck-testable]#Each Bean Validation provider must recognize built-in constraint annotations as valid constraint definitions and provide compliant constraint implementations for each.# [tck-testable]#The built-in constraint validation implementation is having a lower priority than an XML mapping definition.# In other words [classname]`ConstraintValidator` implementations for built-in constraints can be overridden by using the XML mapping (see <<xml-mapping-constraintdefinition>>).

All built-in constraints are in the [classname]`javax.validation.constraints` package. Here is the list of constraints and their declaration.

.[tck-testable]#@Null constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Null.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@NotNull constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/NotNull.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@AssertTrue constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/AssertTrue.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@AssertFalse constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/AssertFalse.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@Min constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Min.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@Max constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Max.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@DecimalMin constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/DecimalMin.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@DecimalMax constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/DecimalMax.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@Negative constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Negative.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@Positive constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Positive.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@Size constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Size.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@Digits constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Digits.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@Past constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Past.java[lines=7..8;29..-1]
----

====

.[tck-testable]#@Future constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Future.java[lines=7..8;29..-1]
----

====

.[tck-testable]#@Pattern constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Pattern.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@NotEmpty constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/NotEmpty.java[lines=7..8;27..-1]
----

====

.[tck-testable]#@NotBlank constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/NotBlank.java[lines=7..8;27..-1]
----

====

.[tck-testable]#@Email constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Email.java[lines=7..8;28..-1]
----

====
<commit_msg>BVAL-616 Adding @PositiveOrZero and @NegativeOrZero constraints<commit_after>// Bean Validation
//
// License: Apache License, Version 2.0
// See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.

[[builtinconstraints]]

== Built-in Constraint definitions

The specification defines a small set of built-in constraints. Their usage is encouraged both in regular constraint declarations and as composing constraints. Using this set of constraints will enhance portability of your constraints across constraint-consuming frameworks relying on the metadata API (such as client side validation frameworks or database schema generation frameworks).

Built-in annotations are annotated with an empty [classname]`@Constraint` annotation to avoid any dependency between the specification API and a specific implementation. [tck-testable]#Each Bean Validation provider must recognize built-in constraint annotations as valid constraint definitions and provide compliant constraint implementations for each.# [tck-testable]#The built-in constraint validation implementation is having a lower priority than an XML mapping definition.# In other words [classname]`ConstraintValidator` implementations for built-in constraints can be overridden by using the XML mapping (see <<xml-mapping-constraintdefinition>>).

All built-in constraints are in the [classname]`javax.validation.constraints` package. Here is the list of constraints and their declaration.

.[tck-testable]#@Null constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Null.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@NotNull constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/NotNull.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@AssertTrue constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/AssertTrue.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@AssertFalse constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/AssertFalse.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@Min constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Min.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@Max constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Max.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@DecimalMin constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/DecimalMin.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@DecimalMax constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/DecimalMax.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@Negative constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Negative.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@NegativeOrZero constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/NegativeOrZero.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@Positive constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Positive.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@PositiveOrZero constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/PositiveOrZero.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@Size constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Size.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@Digits constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Digits.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@Past constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Past.java[lines=7..8;29..-1]
----

====

.[tck-testable]#@Future constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Future.java[lines=7..8;29..-1]
----

====

.[tck-testable]#@Pattern constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Pattern.java[lines=7..8;26..-1]
----

====

.[tck-testable]#@NotEmpty constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/NotEmpty.java[lines=7..8;27..-1]
----

====

.[tck-testable]#@NotBlank constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/NotBlank.java[lines=7..8;27..-1]
----

====

.[tck-testable]#@Email constraint#
====

[source, JAVA, indent=0]
----
include::{validation-api-source-dir}javax/validation/constraints/Email.java[lines=7..8;28..-1]
----

====

{'fraction_non_alphanumeric': 0.20278229082047117, 'fraction_numerical': 0.024268887083671812, 'mean_word_length': 4.567552289429056, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5199735', 'n_tokens_mistral': 3376, 'n_tokens_neox': 3312, 'n_words': 563}