# Language zh-CN translations for PACKAGE package.
# Automatically generated, 2011.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2012-05-09 09:42+0000\n"
"PO-Revision-Date: 2011-02-11 14:56+0000\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: zh-CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#. Tag: title
#: customoptions.xml:24
#, no-c-format
msgid "Hibernate Validator Specifics"
msgstr ""

#. Tag: para
#: customoptions.xml:26
#, no-c-format
msgid ""
"In the following sections we are having a closer look at some of the "
"Hibernate Validator specific features (features which are not part of the "
"Bean Validation specification). This includes the fail fast mode, the "
"programmatic constraint configuration API and boolean composition of "
"composing constraints."
msgstr ""

#. Tag: para
#: customoptions.xml:33
#, no-c-format
msgid ""
"The features described in the following sections are not portable between "
"Bean Validation providers/implementations."
msgstr ""

#. Tag: title
#: customoptions.xml:38
#, no-c-format
msgid "Public API"
msgstr ""

#. Tag: para
#: customoptions.xml:40
#, no-c-format
msgid ""
"Let's start, however, with a look at the public API of Hibernate Validator. "
"<xref linkend=\"validator-public-api\"/> lists all packages belonging to "
"this API and describes their purpose."
msgstr ""

#. Tag: para
#: customoptions.xml:44
#, no-c-format
msgid ""
"Any packages not listed in that table are internal packages of Hibernate "
"Validator and are not intended to be accessed by clients. The contents of "
"these internal packages can change from release to release without notice, "
"thus possibly breaking any client code relying on it."
msgstr ""

#. Tag: para
#: customoptions.xml:51
#, no-c-format
msgid ""
"In the following table, when a package is public its not necessarily true "
"for its nested packages."
msgstr ""

#. Tag: title
#: customoptions.xml:56
#, no-c-format
msgid "Hibernate Validator public API"
msgstr ""

#. Tag: entry
#: customoptions.xml:61
#, no-c-format
msgid "Packages"
msgstr ""

#. Tag: entry
#: customoptions.xml:63
#, no-c-format
msgid "Description"
msgstr ""

#. Tag: package
#: customoptions.xml:69
#, no-c-format
msgid "org.hibernate.validator"
msgstr ""

#. Tag: entry
#: customoptions.xml:71
#, no-c-format
msgid ""
"This package contains the classes used by the Bean Validation bootstrap "
"mechanism (eg. validation provider, configuration class). For more details "
"see <xref linkend=\"validator-bootstrapping\"/>."
msgstr ""

#. Tag: entry
#: customoptions.xml:78
#, no-c-format
msgid ""
"<package>org.hibernate.validator.cfg</package>, <package>org.hibernate."
"validator.cfg.context</package>, <package>org.hibernate.validator.cfg.defs</"
"package>"
msgstr ""

#. Tag: entry
#: customoptions.xml:82
#, no-c-format
msgid ""
"With Hibernate Validator you can define constraints via a fluent API. These "
"packages contain all classes needed to use this feature. In the package "
"<package>org.hibernate.validator.cfg</package> you will find the "
"<classname>ConstraintMapping</classname> class and in package <package>org."
"hibernate.validator.cfg.defs</package> all constraint definitions. For more "
"details see <xref linkend=\"programmaticapi\"/>."
msgstr ""

#. Tag: entry
#: customoptions.xml:93
#, no-c-format
msgid ""
"<package>org.hibernate.validator.constraints</package>, <package>org."
"hibernate.validator.constraints.br</package>"
msgstr ""

#. Tag: entry
#: customoptions.xml:96
#, no-c-format
msgid ""
"In addition to Bean Validation constraints, Hibernate Validator provides "
"some useful custom constraints. These packages contain all custom annotation "
"classes. For more details see <xref linkend=\"validator-defineconstraints-hv-"
"constraints\"/>."
msgstr ""

#. Tag: entry
#: customoptions.xml:103
#, no-c-format
msgid ""
"<package>org.hibernate.validator.group</package>, <package>org.hibernate."
"validator.spi.group</package>"
msgstr ""

#. Tag: entry
#: customoptions.xml:106
#, no-c-format
msgid ""
"With Hibernate Validator you can define dynamic default group sequences in "
"function of the validated object state. These packages contain all classes "
"needed to use this feature (<classname>GroupSequenceProvider</classname> "
"annotation and <classname>DefaultGroupSequenceProvider</classname> "
"contract). For more details see <xref linkend=\"section-default-group-class"
"\"/>."
msgstr ""

#. Tag: entry
#: customoptions.xml:116
#, no-c-format
msgid ""
"<package>org.hibernate.validator.messageinterpolation</package>, "
"<package>org.hibernate.validator.resourceloading</package>, <package>org."
"hibernate.validator.spi.resourceloading</package>"
msgstr ""

#. Tag: entry
#: customoptions.xml:120
#, no-c-format
msgid ""
"These packages contain the classes related to constraint message "
"interpolation. The first package contains two implementations of "
"<classname>MessageInterpolator</classname>. The first one, "
"<classname>ValueFormatterMessageInterpolator</classname> allows to "
"interpolate the validated value into the constraint message, see <xref "
"linkend=\"section-message-interpolator\"/>. The second implementation named "
"<classname>ResourceBundleMessageInterpolator</classname> is the "
"implementation used by default by Hibernate Validator. This implementation "
"relies on a <classname>ResourceBundleLocator</classname>, see <xref linkend="
"\"section-resource-bundle-locator\"/>. Hibernate Validator provides "
"different <classname>ResourceBundleLocator</classname> implementations "
"located in the package <package>org.hibernate.validator.resourceloading</"
"package>."
msgstr ""

#. Tag: entry
#: customoptions.xml:139
#, no-c-format
msgid ""
"<package>org.hibernate.validator.method</package>, <package>org.hibernate."
"validator.method.metadata</package>"
msgstr ""

#. Tag: entry
#: customoptions.xml:142
#, no-c-format
msgid ""
"Hibernate Validator provides support for method-level constraints based on "
"appendix C of the Bean Validation specification. The first package contains "
"the <classname>MethodValidator</classname> interface allowing you to "
"validate method return values and parameters. The second package contains "
"meta data for constraints hosted on parameters and methods which can be "
"retrieved via the <classname>MethodValidator</classname>."
msgstr ""

#. Tag: para
#: customoptions.xml:156
#, no-c-format
msgid ""
"The public packages of Hibernate Validator fall into two categories: while "
"the actual API parts are intended to be <emphasis>invoked</emphasis> or "
"<emphasis>used</emphasis> by clients (e.g. the API for programmatic "
"constraint declaration or the custom constraints), the SPI (service provider "
"interface) packages contain interfaces which are intended to be "
"<emphasis>implemented</emphasis> by clients (e.g. "
"<classname>ResourceBundleLocator</classname>)."
msgstr ""

#. Tag: title
#: customoptions.xml:167
#, no-c-format
msgid "Fail fast mode"
msgstr ""

#. Tag: para
#: customoptions.xml:169
#, no-c-format
msgid ""
"First off, the fail fast mode. Hibernate Validator allows to return from the "
"current validation as soon as the first constraint violation occurs. This is "
"called the <emphasis>fail fast mode</emphasis> and can be useful for "
"validation of large object graphs where one is only interested whether there "
"is a constraint violation or not. <xref linkend=\"example-fail-fast-property"
"\"/>, <xref linkend=\"example-fail-fast-configuration\"/> and <xref linkend="
"\"example-fail-fast-factory\"/> show multiple ways to enable the fail fast "
"mode."
msgstr ""

#. Tag: title
#: customoptions.xml:180
#, no-c-format
msgid "Enabling <option>failFast</option> via a property"
msgstr ""

#. Tag: programlisting
#: customoptions.xml:182
#, no-c-format
msgid ""
"HibernateValidatorConfiguration configuration = Validation.byProvider"
"( HibernateValidator.class ).configure();\n"
"ValidatorFactory factory = configuration.addProperty( \"hibernate.validator."
"fail_fast\", \"true\" ).buildValidatorFactory();\n"
"Validator validator = factory.getValidator();\n"
"\n"
"// do some actual fail fast validation\n"
"..."
msgstr ""

#. Tag: title
#: customoptions.xml:186
#, no-c-format
msgid ""
"Enabling <option>failFast</option> at the <classname>Configuration</"
"classname> level"
msgstr ""

#. Tag: programlisting
#: customoptions.xml:189
#, no-c-format
msgid ""
"HibernateValidatorConfiguration configuration = Validation.byProvider"
"( HibernateValidator.class ).configure();\n"
"ValidatorFactory factory = configuration.failFast( true )."
"buildValidatorFactory();\n"
"Validator validator = factory.getValidator();\n"
"\n"
"// do some actual fail fast validation\n"
"..."
msgstr ""

#. Tag: title
#: customoptions.xml:193
#, no-c-format
msgid ""
"Enabling <option>failFast</option> at the <classname>ValidatorFactory</"
"classname> level"
msgstr ""

#. Tag: programlisting
#: customoptions.xml:196
#, no-c-format
msgid ""
"HibernateValidatorConfiguration configuration = Validation.byProvider"
"( HibernateValidator.class ).configure();\n"
"ValidatorFactory factory = configuration.buildValidatorFactory();\n"
"\n"
"Validator validator = factory.getValidator();\n"
"\n"
"// do some non fail fast validation\n"
"...\n"
"\n"
"validator = factory.unwrap( HibernateValidatorFactory.class )\n"
"            .usingContext()\n"
"            .failFast( true )\n"
"            .getValidator();\n"
"\n"
"// do fail fast validation\n"
"..."
msgstr ""

#. Tag: title
#: customoptions.xml:201
#, no-c-format
msgid "Method validation"
msgstr ""

#. Tag: para
#: customoptions.xml:203
#, no-c-format
msgid ""
"The Bean Validation API allows to specify constraints for fields, properties "
"and types. Hibernate Validator goes one step further and allows to place "
"contraint annotations also on method parameters and method return values, "
"thus enabling a programming style known as \"Programming by Contract\"."
msgstr ""

#. Tag: para
#: customoptions.xml:209
#, no-c-format
msgid ""
"More specifically this means that Bean Validation constraints can be used to "
"specify"
msgstr ""

#. Tag: para
#: customoptions.xml:214
#, no-c-format
msgid ""
"the preconditions that must be met before a method invocation (by annotating "
"method parameters with constraints) and"
msgstr ""

#. Tag: para
#: customoptions.xml:219
#, no-c-format
msgid ""
"the postconditions that are guaranteed after a method invocation (by "
"annotating methods)"
msgstr ""

#. Tag: para
#: customoptions.xml:224
#, no-c-format
msgid ""
"This approach has several advantages over traditional ways of parameter and "
"return value checking:"
msgstr ""

#. Tag: para
#: customoptions.xml:229
#, no-c-format
msgid ""
"The checks don't have to be performed manually (e.g. by throwing "
"<classname>IllegalArgumentExceptions</classname> or similar), resulting in "
"less code to write and maintain."
msgstr ""

#. Tag: para
#: customoptions.xml:235
#, no-c-format
msgid ""
"A method's pre- and postconditions don't have to be expressed again in the "
"method's JavaDoc, since the constraint annotations will automatically be "
"included in the generated JavaDoc. This avoids redundancy and reduces the "
"chance of inconsistencies between implementation and documentation."
msgstr ""

#. Tag: para
#: customoptions.xml:244
#, no-c-format
msgid ""
"Method validation was also considered to be included in the Bean Validation "
"API as defined by JSR 303, but it didn't become part of the 1.0 version. A "
"basic draft is outlined in appendix C of the specification, and the "
"implementation in Hibernate Validator is largely influenced by this draft. "
"The feature is considered again for inclusion in BV 1.1."
msgstr ""

#. Tag: title
#: customoptions.xml:253
#, no-c-format
msgid "Defining method-level constraints"
msgstr ""

#. Tag: para
#: customoptions.xml:255
#, no-c-format
msgid "demonstrates the definition of method-level constraints."
msgstr ""

#. Tag: title
#: customoptions.xml:258
#, no-c-format
msgid "Using method-level constraints"
msgstr ""

#. Tag: programlisting
#: customoptions.xml:260
#, no-c-format
msgid ""
"public class RentalStation {\n"
"\n"
"    @NotNull \n"
"    public Car rentCar(@NotNull Customer customer, @NotNull @Future Date "
"startDate, @Min(1) int durationInDays) { \n"
"        //...\n"
"    }\n"
"}"
msgstr ""

#. Tag: para
#: customoptions.xml:263
#, no-c-format
msgid ""
"Here the following pre- and postconditions for the <methodname>rentCar()</"
"methodname> method are declared:"
msgstr ""

#. Tag: para
#: customoptions.xml:268
#, no-c-format
msgid "The renting customer may not be null"
msgstr ""

#. Tag: para
#: customoptions.xml:272
#, no-c-format
msgid "The rental's start date must not be null and must be in the future"
msgstr ""

#. Tag: para
#: customoptions.xml:277
#, no-c-format
msgid "The rental duration must be at least one day"
msgstr ""

#. Tag: para
#: customoptions.xml:281
#, no-c-format
msgid "The returned <classname>Car</classname> instance may not be null"
msgstr ""

#. Tag: para
#: customoptions.xml:286
#, no-c-format
msgid ""
"Using the <classname>@Valid</classname> annotation it's also possible to "
"define that a cascaded validation of parameter or return value objects shall "
"be performed. An example can be found in <xref lang=\"\" linkend=\"example-"
"cascaded-method-constraints\"/>."
msgstr ""

#. Tag: title
#: customoptions.xml:292
#, no-c-format
msgid "Cascaded validation of method-level constraints"
msgstr ""

#. Tag: programlisting
#: customoptions.xml:294
#, no-c-format
msgid ""
"public class RentalStation {\n"
"\n"
"    @Valid\n"
"    public Set&lt;Rental&gt; getRentalsByCustomer(@Valid Customer customer) "
"{ \n"
"        //...\n"
"    }\n"
"}"
msgstr ""

#. Tag: para
#: customoptions.xml:297
#, no-c-format
msgid ""
"Here all the constraints declared at the <classname>Customer</classname> "
"type will be evaluated when validating the method parameter and all "
"constraints declared at the returned <classname>Rental</classname> objects "
"will be evaluated when validating the method's return value."
msgstr ""

#. Tag: title
#: customoptions.xml:304
#, no-c-format
msgid "Using method constraints in type hierarchies"
msgstr ""

#. Tag: para
#: customoptions.xml:306
#, no-c-format
msgid ""
"Special care must be taken when defining parameter constraints in "
"inheritance hierarchies."
msgstr ""

#. Tag: para
#: customoptions.xml:309
#, no-c-format
msgid ""
"When a method is overridden in sub-types method parameter constraints can "
"only be declared at the base type. The reason for this restriction is that "
"the preconditions to be fulfilled by a type's client must not be "
"strengthened in sub-types (which may not even be known to the base type's "
"client). Note that also if the base method doesn't declare any parameter "
"constraints at all, no parameter constraints may be added in overriding "
"methods."
msgstr ""

#. Tag: para
#: customoptions.xml:317
#, no-c-format
msgid ""
"The same restriction applies to interface methods: no parameter constraints "
"may be defined at the implementing method (or the same method declared in "
"sub-interfaces)."
msgstr ""

#. Tag: para
#: customoptions.xml:321
#, no-c-format
msgid ""
"If a violation of this rule is detected by the validation engine, a "
"<classname>javax.validation.ConstraintDeclarationException</classname> will "
"be thrown. In <xref lang=\"\" linkend=\"example-illegal-method-constraints\"/"
"> some examples for illegal parameter constraints declarations are shown."
msgstr ""

#. Tag: title
#: customoptions.xml:329
#, no-c-format
msgid "Illegal parameter constraint declarations"
msgstr ""

#. Tag: programlisting
#: customoptions.xml:331
#, no-c-format
msgid ""
"public class Car {\n"
"\n"
"    public void drive(Person driver) { ... }\n"
"\n"
"}\n"
"\n"
"public class RentalCar extends Car {\n"
"\n"
"    //not allowed, parameter constraint added in overriding method\n"
"    public void drive(@NotNull Person driver) { ... }\n"
"\n"
"}\n"
"\n"
"public interface ICar {\n"
"\n"
"    void drive(Person driver);\n"
"\n"
"}\n"
"\n"
"public class CarImpl implements ICar {\n"
"\n"
"    //not allowed, parameter constraint added in implementation of interface "
"method\n"
"    public void drive(@NotNull Person driver) { ... }\n"
"\n"
"}"
msgstr ""

#. Tag: para
#: customoptions.xml:334
#, no-c-format
msgid ""
"This rule only applies to parameter constraints, return value constraints "
"may be added in sub-types without any restrictions as it is alright to "
"strengthen the postconditions guaranteed to a type's client."
msgstr ""

#. Tag: title
#: customoptions.xml:342
#, no-c-format
msgid "Evaluating method-level constraints"
msgstr ""

#. Tag: para
#: customoptions.xml:344
#, no-c-format
msgid ""
"To validate method-level constraints Hibernate Validator provides the "
"interface <classname>org.hibernate.validator.method.MethodValidator</"
"classname>."
msgstr ""

#. Tag: para
#: customoptions.xml:348
#, no-c-format
msgid ""
"As shown in <xref lang=\"\" linkend=\"example-methodvalidator\"/> this "
"interface defines methods for the evaluation of parameter as well as return "
"value constraints and for retrieving an extended type descriptor providing "
"method constraint related meta data."
msgstr ""

#. Tag: title
#: customoptions.xml:354
#, no-c-format
msgid "The <classname>MethodValidator</classname> interface"
msgstr ""

#. Tag: programlisting
#: customoptions.xml:356
#, no-c-format
msgid ""
"public interface MethodValidator {\n"
"\n"
"    &lt;T&gt; Set&lt;MethodConstraintViolation&lt;T&gt;&gt; validateParameter"
"(T object, Method method, Object parameterValue, int parameterIndex, "
"Class&lt;?&gt;... groups);\n"
"    \n"
"    &lt;T&gt; Set&lt;MethodConstraintViolation&lt;T&gt;&gt; "
"validateAllParameters(T object, Method method, Object[] parameterValues, "
"Class&lt;?&gt;... groups);\n"
"    \n"
"    &lt;T&gt; Set&lt;MethodConstraintViolation&lt;T&gt;&gt; "
"validateReturnValue(T object, Method method, Object returnValue, Class&lt;?"
"&gt;... groups);\n"
" \n"
"    TypeDescriptor getConstraintsForType(Class&lt;?&gt; clazz);\n"
"}"
msgstr ""

#. Tag: para
#: customoptions.xml:359
#, no-c-format
msgid ""
"To retrieve a method validator get hold of an instance of HV's "
"<classname>javax.validation.Validator</classname> implementation and unwrap "
"it to <classname>MethodValidator</classname> as shown in <xref lang=\"\" "
"linkend=\"example-retrieving-methodvalidator\"/>."
msgstr ""

#. Tag: title
#: customoptions.xml:365
#, no-c-format
msgid "Retrieving a <classname>MethodValidator</classname> instance"
msgstr ""

#. Tag: programlisting
#: customoptions.xml:368
#, no-c-format
msgid ""
"MethodValidator methodValidator = Validation.byProvider( HibernateValidator."
"class )\n"
"    .configure()\n"
"    .buildValidatorFactory()\n"
"    .getValidator()\n"
"    .unwrap( MethodValidator.class );"
msgstr ""

#. Tag: para
#: customoptions.xml:371
#, no-c-format
msgid ""
"The validation methods defined on <classname>MethodValidator</classname> "
"each return a <classname>Set&lt;MethodConstraintViolation&gt;</classname>. "
"The type <classname>MethodConstraintViolation</classname> (see <xref lang="
"\"\" linkend=\"example-methodconstraintviolation\"/>) extends "
"<classname>javax.validation.ConstraintViolation</classname> and provides "
"additional method level validation specific information such as the method "
"and index of the parameter which caused the constraint violation."
msgstr ""

#. Tag: title
#: customoptions.xml:382
#, no-c-format
msgid "The <classname>MethodConstraintViolation</classname> type"
msgstr ""

#. Tag: programlisting
#: customoptions.xml:385
#, no-c-format
msgid ""
"public interface MethodConstraintViolation&lt;T&gt; extends "
"ConstraintViolation&lt;T&gt; {\n"
"    \n"
"    public static enum Kind { PARAMETER, RETURN_VALUE }\n"
"\n"
"    Method getMethod();\n"
"\n"
"    Integer getParameterIndex();\n"
"\n"
"    String getParameterName();\n"
"\n"
"    Kind getKind();\n"
"}"
msgstr ""

#. Tag: para
#: customoptions.xml:389
#, no-c-format
msgid ""
"The method <methodname>getParameterName()</methodname> currently returns "
"synthetic parameter identifiers such as \"arg0\", \"arg1\" etc. In a future "
"version of Hibernate Validator support for specifying parameter identifiers "
"might be added."
msgstr ""

#. Tag: para
#: customoptions.xml:395
#, no-c-format
msgid ""
"Typically the validation of method-level constraints is not invoked manually "
"but automatically upon method invocation by an integration layer using AOP "
"(aspect-oriented programming) or similar method interception facilities such "
"as the JDK's <classname>java.lang.reflect.Proxy</classname> API or CDI "
"(\"JSR 299: Contexts and Dependency Injection for the Java<superscript>TM</"
"superscript> EE platform\")."
msgstr ""

#. Tag: para
#: customoptions.xml:403
#, no-c-format
msgid ""
"If a parameter or return value constraint can't be validated sucessfully "
"such an integration layer typically will throw a "
"<classname>MethodConstraintViolationException</classname> which similar to "
"<classname>javax.validation.ConstraintViolationException</classname> "
"contains a set with the occurred constraint violations."
msgstr ""

#. Tag: para
#: customoptions.xml:410
#, no-c-format
msgid ""
"If you are using CDI you might be interested in the <ulink url=\"http://"
"seamframework.org/Seam3/ValidationModule\">Seam Validation</ulink> project. "
"This Seam module provides an interceptor which integrates the method "
"validation functionality with CDI."
msgstr ""

#. Tag: title
#: customoptions.xml:418
#, no-c-format
msgid "Retrieving method-level constraint meta data"
msgstr ""

#. Tag: para
#: customoptions.xml:420
#, no-c-format
msgid ""
"As outlined in <xref lang=\"\" linkend=\"validator-metadata-api\"/> the Bean "
"Validation API provides rich capabilities for retrieving constraint related "
"meta data. Hibernate Validator extends this API and allows to retrieve "
"constraint meta data also for method-level constraints."
msgstr ""

#. Tag: para
#: customoptions.xml:426
#, no-c-format
msgid ""
"shows how to use this extended API to retrieve constraint meta data for the "
"<methodname>rentCar()</methodname> method from the <classname>RentalStation</"
"classname> type."
msgstr ""

#. Tag: title
#: customoptions.xml:432
#, no-c-format
msgid "Retrieving meta data for method-level constraints"
msgstr ""

#. Tag: programlisting
#: customoptions.xml:434
#, no-c-format
msgid ""
"TypeDescriptor typeDescriptor = methodValidator.getConstraintsForType"
"(RentalStation.class)\n"
"\n"
"//retrieve a descriptor for the rentCar() method\n"
"MethodDescriptor rentCarMethod = typeDescriptor.getConstraintsForMethod"
"(\"rentCar\", Customer.class, Date.class, int.class);\n"
"assertEquals(rentCarMethod.getMethodName(), \"rentCar\");\n"
"assertTrue(rentCarMethod.hasConstraints());\n"
"assertFalse(rentCarMethod.isCascaded());\n"
"\n"
"//retrieve constraints from the return value\n"
"Set&lt;ConstraintDescriptor&lt;?&gt;&gt; returnValueConstraints = "
"rentCarMethod.findConstraints().getConstraintDescriptors();\n"
"assertEquals(returnValueConstraints.size(), 1);\n"
"assertEquals(returnValueConstraints.iterator().next().getAnnotation()."
"annotationType(), NotNull.class);\n"
"\n"
"List&lt;ParameterDescriptor&gt; allParameters = rentCarMethod."
"getParameterDescriptors();\n"
"assertEquals(allParameters.size(), 3);\n"
"\n"
"//retrieve a descriptor for the startDate parameter\n"
"ParameterDescriptor startDateParameter = allParameters.get(1);\n"
"assertEquals(startDateParameter.getIndex(), 1);\n"
"assertFalse(startDateParameter.isCascaded());\n"
"assertEquals(startDateParameter.findConstraints().getConstraintDescriptors()."
"size(), 2);"
msgstr ""

#. Tag: para
#: customoptions.xml:437
#, no-c-format
msgid ""
"Refer to the <ulink url=\"http://docs.jboss.org/hibernate/validator/4.2/api/"
"index.html?org/hibernate/validator/method/metadata/package-summary.html"
"\">JavaDoc</ulink> of the package <classname>org.hibernate.validator.method."
"metadata</classname> for more details on the extended meta data API."
msgstr ""

#. Tag: title
#: customoptions.xml:446 customoptions.xml:462
#, no-c-format
msgid "Programmatic constraint definition"
msgstr ""

#. Tag: para
#: customoptions.xml:448
#, no-c-format
msgid ""
"Another addition to the Bean Validation specification is the ability to "
"configure constraints via a fluent API. This API can be used exclusively or "
"in combination with annotations and xml. If used in combination programmatic "
"constraints are additive to constraints configured via the standard "
"configuration capabilities."
msgstr ""

#. Tag: para
#: customoptions.xml:454
#, no-c-format
msgid ""
"The API is centered around the <classname>ConstraintMapping</classname> "
"class which can be found in the package<package> org.hibernate.validator."
"cfg</package>. Starting with the instantiation of a new "
"<classname>ConstraintMapping</classname>, constraints can be defined in a "
"fluent manner as shown in <xref lang=\"\" linkend=\"example-constraint-"
"mapping\"/>."
msgstr ""

#. Tag: programlisting
#: customoptions.xml:464
#, no-c-format
msgid ""
"ConstraintMapping mapping = new ConstraintMapping();\n"
"mapping.type( Car.class )\n"
"    .property( \"manufacturer\", FIELD )\n"
"        .constraint( new NotNullDef() )\n"
"    .property( \"licensePlate\", FIELD )\n"
"        .constraint( new NotNullDef() )\n"
"        .constraint( new SizeDef().min( 2 ).max( 14 ) )\n"
"    .property( \"seatCount\", FIELD )\n"
"        .constraint( new MinDef()value ( 2 ) )\n"
".type( RentalCar.class )\n"
"    .property( \"rentalStation\", METHOD )\n"
"        .constraint( new NotNullDef() );"
msgstr ""

#. Tag: para
#: customoptions.xml:467
#, no-c-format
msgid ""
"As you can see constraints can be configured on multiple classes and "
"properties using method chaining. The constraint definition classes "
"<classname>NotNullDef</classname>, <classname>SizeDef</classname> and "
"<classname>MinDef</classname> are helper classes which allow to configure "
"constraint parameters in a type-safe fashion. Definition classes exist for "
"all built-in constraints in the <classname>org.hibernate.validator.cfg.defs</"
"classname> package."
msgstr ""

#. Tag: para
#: customoptions.xml:475
#, no-c-format
msgid ""
"For custom constraints you can either create your own definition classes "
"extending <classname>ConstraintDef</classname> or you can use "
"<classname>GenericConstraintDef</classname> as seen in <xref linkend="
"\"example-generic-constraint-mapping\"/>."
msgstr ""

#. Tag: title
#: customoptions.xml:481
#, no-c-format
msgid ""
"Programmatic constraint definition using <methodname>createGeneric()</"
"methodname>"
msgstr ""

#. Tag: programlisting
#: customoptions.xml:484
#, no-c-format
msgid ""
"ConstraintMapping mapping = new ConstraintMapping();\n"
"mapping.type( Car.class )\n"
"    .property( \"licensePlate\", FIELD )\n"
"        .constraint( new GenericConstraintDef&lt;CheckCase.class&gt;"
"( CheckCase.class ).param( \"value\", CaseMode.UPPER ) );"
msgstr ""

#. Tag: para
#: customoptions.xml:487
#, no-c-format
msgid ""
"Not only standard class- and property-level constraints but also method "
"constraints can be configured using the API. As shown in <xref lang=\"\" "
"linkend=\"example-method-constraint-mapping\"/> methods are identified by "
"their name and their parameters (if there are any). Having selected a "
"method, constraints can be placed on the method's parameters and/or return "
"value."
msgstr ""

#. Tag: title
#: customoptions.xml:495
#, no-c-format
msgid "Programmatic definition of method constraints"
msgstr ""

#. Tag: programlisting
#: customoptions.xml:497
#, no-c-format
msgid ""
"ConstraintMapping mapping = new ConstraintMapping();\n"
"mapping.type( Car.class )\n"
"    .method( \"drive\", String.class, Integer.class )\n"
"        .parameter( 0 )\n"
"            .constraint( new NotNullDef() )\n"
"            .constraint( new MinDef().value ( 1 ) )\n"
"        .parameter( 1 )\n"
"            .constraint( new NotNullDef() )\n"
"        .returnValue()\n"
"            .constraint( new NotNullDef() )\n"
"    .method( \"check\" )\n"
"        .returnValue()\n"
"            .constraint( new NotNullDef() );"
msgstr ""

#. Tag: para
#: customoptions.xml:500
#, no-c-format
msgid ""
"Using the API it's also possible to mark properties, method parameters and "
"method return values as cascading (equivalent to annotating them with "
"<classname>@Valid</classname>). An example can be found in <xref lang=\"\" "
"linkend=\"example-cascading-constraints\"/>."
msgstr ""

#. Tag: title
#: customoptions.xml:506
#, no-c-format
msgid "Marking constraints for cascaded validation"
msgstr ""

#. Tag: programlisting
#: customoptions.xml:508
#, no-c-format
msgid ""
"ConstraintMapping mapping = new ConstraintMapping();\n"
"mapping.type( Car.class )\n"
"    .property( \"manufacturer\", FIELD )\n"
"        .valid()\n"
"    .property( \"licensePlate\", METHOD )\n"
"        .valid()\n"
"    .method( \"drive\", String.class, Integer.class )\n"
"        .parameter( 0 )\n"
"            .valid()\n"
"        .parameter( 1 )\n"
"            .valid()\n"
"        .returnValue()\n"
"            .valid()\n"
".type( RentalCar.class )\n"
"    .property( \"rentalStation\", METHOD )\n"
"        .valid();"
msgstr ""

#. Tag: para
#: customoptions.xml:511
#, no-c-format
msgid ""
"Last but not least you can configure the default group sequence or the "
"default group sequence provider of a type as shown in <xref lang=\"\" "
"linkend=\"example-sequences\"/>."
msgstr ""

#. Tag: title
#: customoptions.xml:514
#, no-c-format
msgid ""
"Configuration of default group sequence and default group sequence provider"
msgstr ""

#. Tag: programlisting
#: customoptions.xml:517
#, no-c-format
msgid ""
"ConstraintMapping mapping = new ConstraintMapping();\n"
"mapping.type( Car.class )\n"
"    .defaultGroupSequence( Car.class, CarChecks.class )\n"
".type( RentalCar.class )\n"
"    .defaultGroupSequenceProvider( RentalCarGroupSequenceProvider.class );"
msgstr ""

#. Tag: para
#: customoptions.xml:520
#, no-c-format
msgid ""
"Once a <classname>ConstraintMapping</classname> is set up it has to be "
"passed to the configuration. Since the programmatic API is not part of the "
"official Bean Validation specification you need to get hold of a "
"<classname>HibernateValidatorConfiguration</classname> instance as shown in "
"<xref linkend=\"example-hibernate-specific-config\"/>."
msgstr ""

#. Tag: title
#: customoptions.xml:527
#, no-c-format
msgid "Creating a Hibernate Validator specific configuration"
msgstr ""

#. Tag: programlisting
#: customoptions.xml:529
#, no-c-format
msgid ""
"ConstraintMapping mapping = new ConstraintMapping();\n"
"// configure mapping instance\n"
"\n"
"HibernateValidatorConfiguration config = Validation.byProvider"
"( HibernateValidator.class ).configure();\n"
"config.addMapping( mapping );\n"
"ValidatorFactory factory = config.buildValidatorFactory();\n"
"Validator validator = factory.getValidator();"
msgstr ""

#. Tag: title
#: customoptions.xml:534
#, no-c-format
msgid "Boolean composition for constraint composition"
msgstr ""

#. Tag: para
#: customoptions.xml:536
#, no-c-format
msgid ""
"As per Bean Validation specification the constraints of a composed "
"constraint (see <xref linkend=\"section-constraint-composition\"/>) are all "
"combined via a logical <emphasis>AND</emphasis>. This means all of the "
"composing constraints need to return <constant>true</constant> in order for "
"an overall successful validation. Hibernate Validator offers an extension to "
"this logical <emphasis>AND</emphasis> combination which allows you to "
"compose constraints via a logical <emphasis>OR</emphasis> or <emphasis>NOT</"
"emphasis>. To do so you have to use the <classname>ConstraintComposition</"
"classname> annotation and the enum <classname>CompositionType</classname> "
"with its values <emphasis>AND</emphasis>, <emphasis>OR</emphasis> and "
"<emphasis>ALL_FALSE</emphasis>. <xref linkend=\"example-boolean-constraint-"
"composition\"/> shows how to build a composing constraint where only one of "
"the constraints has to be successful in order to pass the validation. Either "
"the validated string is all lowercased or it is between two and three "
"characters long."
msgstr ""

#. Tag: title
#: customoptions.xml:554
#, no-c-format
msgid "OR composition of constraints"
msgstr ""

#. Tag: programlisting
#: customoptions.xml:556
#, no-c-format
msgid ""
"<emphasis role=\"bold\">@ConstraintComposition(OR)</emphasis>\n"
"@Pattern(regexp = \"[a-z]\")\n"
"@Size(min = 2, max = 3)\n"
"@ReportAsSingleViolation\n"
"@Target({ METHOD, FIELD })\n"
"@Retention(RUNTIME)\n"
"@Constraint(validatedBy = { })\n"
"public @interface PatternOrSize {\n"
"   public abstract String message() default \"{PatternOrSize.message}\";\n"
"   public abstract Class&lt;?&gt;[] groups() default { };\n"
"   public abstract Class&lt;? extends Payload&gt;[] payload() default { };\n"
"}"
msgstr ""

#. Tag: para
#: customoptions.xml:560
#, no-c-format
msgid ""
"Using <emphasis>ALL_FALSE</emphasis> as composition type implicitly enforces "
"that only a single violation will get reported in case validation of the "
"constraint composition fails."
msgstr ""
