uCosminexus Application Server, Common Container Functionality Guide

[Contents][Glossary][Index][Back][Next]

10.4 Bean Validation functionality and Bean Validation operations

This section describes the Bean Validation functionality and Bean Validation operations.

The following table describes the Bean Validation functionality.

Table 10-2 Bean Validation functionality

No. Function Overview
1 Validating the input values This functionality validates the validation definition specifying the value set up in JavaBean.
Group management functionality This functionality groups the validation.
Message management functionality This functionality manages the messages returned when the validation result is an error.
Payload management functionality This functionality categorizes the validation results.#
2 Functionality for creating a custom validator This functionality creates specific validation processing.
3 Bootstrap functionality This functionality enables you to change the Bean Validation provider.

#
If Bean Validation is integrated and used with JSF, the payload management functionality cannot be used.

You can use the Bean Validation function by specifying annotations. The following table describes the annotation classes provided by the Bean Validation function, the variable types that can be specified, and the operations when annotations are specified in the variable types that cannot be specified.

Table 10-3 Annotation classes provided by the Bean Validation function and the types of variables

No. Annotation class Specifiable variable types Operations when annotations are specified in the non-specifiable variable types Remarks
1 Null Can be specified in all types -- --
2 NotNull Can be specified in all types -- --
3 AssertTrue
  • boolean/java.lang.Boolean
javax.validation.UnexpectedTypeException is thrown. --
4 AssertFalse
  • boolean/java.lang.Boolean
javax.validation.UnexpectedTypeException is thrown. --
5 Min
  • java.math.BigDecimal
  • java.math.BigInteger
  • byte/java.lang.Byte
  • short/java.lang.Short
  • int/java.lang.Integer
  • long/java.lang.Long
  • float/java.lang.Float
  • double/java.lang.Double
  • java.lang.String
javax.validation.UnexpectedTypeException is thrown. --
6 Max
  • java.math.BigDecimal
  • java.math.BigInteger
  • byte/java.lang.Byte
  • short/java.lang.Short
  • int/java.lang.Integer
  • long/java.lang.Long
  • float/java.lang.Float
  • double/java.lang.Double
  • java.lang.String
javax.validation.UnexpectedTypeException is thrown. --
7 DecimalMin
  • java.math.BigDecimal
  • java.math.BigInteger
  • java.lang.String
  • byte/java.lang.Byte
  • short/java.lang.Short
  • int/java.lang.Integer
  • long/java.lang.Long
  • float/java.lang.Float
  • double/java.lang.Double
javax.validation.UnexpectedTypeException is thrown. If a value that cannot be parsed with java.math.BigDecimal is specified for the value attribute, javax.validation.ValidationException is thrown.
8 DecimalMax
  • java.math.BigDecimal
  • java.math.BigInteger
  • java.lang.String
  • byte/java.lang.Byte
  • short/java.lang.Short
  • int/java.lang.Integer
  • long/java.lang.Long
  • float/java.lang.Float
  • double/java.lang.Double
javax.validation.UnexpectedTypeException is thrown. If a value that cannot be parsed with java.math.BigDecimal is specified for the value attribute, javax.validation.ValidationException is thrown.
9 Size
  • java.lang.String
  • java.util.Collection
  • java.util.Map
  • Array
javax.validation.UnexpectedTypeException is thrown. If a negative value is specified for the max and min attributes, javax.validation.ValidationException is thrown.
If a value greater than max is specified in the value for min, javax.validation.ValidationException is thrown.
10 Digits
  • java.math.BigDecimal
  • java.math.BigInteger
  • java.lang.String
  • byte/java.lang.Byte
  • short/java.lang.Short
  • int/java.lang.Integer
  • long/java.lang.Long
  • float/java.lang.Float
  • double/java.lang.Double
javax.validation.UnexpectedTypeException is thrown. If a negative value is specified for the integer and fraction attributes, javax.validation.ValidationException is thrown.
11 Past
  • java.util.Date
  • java.util.Calendar
javax.validation.UnexpectedTypeException is thrown. --
12 Future
  • java.util.Date
  • java.util.Calendar
javax.validation.UnexpectedTypeException is thrown. --
13 Pattern
  • java.lang.String
javax.validation.UnexpectedTypeException is thrown. If the value specified for the regexp attribute is an incorrect regular expression, the javax.validation.ValidationException exception is thrown.
The validity of the regular expression depends on the java.util.regex.Pattern specifications.

Legend:
--: Not applicable.