# Language zh-CN translations for PACKAGE package.
# Automatically generated, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2011-01-12 15:42+0000\n"
"PO-Revision-Date: 2010-08-23 23:32+0830\n"
"Last-Translator: Strong Liu <stliu@hibernate.org>\n"
"Language-Team: none\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#. Tag: title
#: programmaticapi.xml:24 programmaticapi.xml:47
#, no-c-format
msgid "Programmatic constraint definition"
msgstr "编程方式应用约束条件"

#. Tag: para
#: programmaticapi.xml:27
#, no-c-format
msgid ""
"Use of the features described in the following sections is not portable "
"between Bean Validation providers/implementations."
msgstr "下面的特性是不可移植的."

#. Tag: para
#: programmaticapi.xml:31
#, no-c-format
msgid ""
"Hibernate Validator allows to configure constraints not only via annotations "
"and xml, but also via a programmatic API. This API can be used exclusively "
"or in combination with annotations and xml. If used in combination "
"programmatic constraints are additive to otherwise configured constraints."
msgstr ""
"Hibernate Validator不仅支持通过标注(annotation) 和xml的方式来给实体定义约束条"
"件, 你也可以通过编程的方式来实现. 这套API即可以覆盖另外两种方式定义的约束条"
"件, 也可以和它们结合在一起使用, 如果是后者的话, 那么它所定义的约束条件会被附"
"加到另外两种方式所定义的约束后面."

#. Tag: para
#: programmaticapi.xml:37
#, no-c-format
msgid ""
"The programmatic API is centered around the <classname>ConstraintMapping</"
"classname> class which can be found together with its supporting classes in "
"the <package>org.hibernate.validator.cfg</package> package. "
"<classname>ConstraintMapping</classname> is the entry point to a fluent API "
"allowing the definition of constraints. <xref lang=\"\" linkend=\"example-"
"constraint-mapping\"/> shows how the API can be used."
msgstr ""
"这套API是以<package>org.hibernate.validator.cfg</package>下面的"
"<classname>ConstraintMapping</classname>为中心点, 此包中还包含一些关联的类. "
"<classname>ConstraintMapping</classname>是实现此功能的入口点. <xref lang="
"\"\" linkend=\"example-constraint-mapping\"/>介绍了如何使用此API."

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

#. Tag: para
#: programmaticapi.xml:52
#, fuzzy, no-c-format
msgid ""
"As you can see you can configure constraints 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 exists for "
"all built-in constraints in the <classname>org.hibernate.validator.cfg.defs</"
"classname> package. For a custom constraint you can either create your own "
"definition class extending <classname>ConstraintDef</classname> or you can "
"use the <classname>genericConstraint</classname> method as seen in <xref "
"linkend=\"example-generic-constraint-mapping\"/>."
msgstr ""
"正如你所看到的, 通过链式API的设计, 你可以给多个实体和属性设置约束条件. 上面所"
"用到的<classname>NotNullDef</classname>, <classname>SizeDef</classname> 等 "
"<classname>MinDef</classname> 只是每个约束条件定义(annotation)所对应的约束定"
"义类, 这样的设计是为了类型安全. <classname>org.hibernate.validator.cfg.defs</"
"classname>下包含有每个内置的约束条件对应的约束定义类. 对于自定义的约束条件来"
"说, 你可以通过继承<classname>ConstraintDef</classname>来创建你自己的约束定义"
"类, 或者你可以使用<classname>GenericConstraintDef</classname>, 请参考<xref "
"linkend=\"example-generic-constraint-mapping\"/>."

#. Tag: title
#: programmaticapi.xml:65
#, no-c-format
msgid ""
"Programmatic constraint definition using <classname>GenericConstraintDef</"
"classname>"
msgstr "通过<classname>GenericConstraintDef</classname>实现约束定义类"

#. Tag: programlisting
#: programmaticapi.xml:68
#, fuzzy, no-c-format
msgid ""
"ConstraintMapping mapping = new ConstraintMapping();\n"
"mapping.type( Car.class )\n"
"    .property( \"licensePlate\", FIELD )\n"
"        .genericConstraint( CheckCase.class )\n"
"            .param( \"value\", CaseMode.UPPER );"
msgstr ""
"ConstraintMapping mapping = new ConstraintMapping();\n"
"mapping.type( Car.class )\n"
"    .property( \"licensePlate\", FIELD )\n"
"        .constraint( GenericConstraintDef.class )\n"
"            .constraintType( CheckCase.class )\n"
"            .param( \"value\", CaseMode.UPPER );"

#. Tag: para
#: programmaticapi.xml:71
#, no-c-format
msgid ""
"Last but not least, you can also define cascading constraints as well as the "
"default group sequence of an entity."
msgstr ""
"最后, 你也可是通过API的方式来实现对一个实体重定义默认组序列和级联约束条件定"
"义."

#. Tag: title
#: programmaticapi.xml:75
#, no-c-format
msgid "Cascading constraints and group redefinition"
msgstr "级联约束和默认组序列定义"

#. Tag: programlisting
#: programmaticapi.xml:77
#, no-c-format
msgid ""
"ConstraintMapping mapping = new ConstraintMapping();\n"
"mapping.type( Car.class )\n"
"    .valid( \"driver\", FIELD )\n"
".type( RentalCar.class)\n"
"    .defaultGroupSequence( RentalCar.class, CarChecks.class );"
msgstr ""
"ConstraintMapping mapping = new ConstraintMapping();\n"
"mapping.type( Car.class )\n"
"    .valid( \"driver\", FIELD )\n"
".type( RentalCar.class)\n"
"    .defaultGroupSequence( RentalCar.class, CarChecks.class );"

#. Tag: para
#: programmaticapi.xml:80
#, no-c-format
msgid ""
"Once you have your <classname>ConstraintMapping</classname> you will have to "
"pass it to the configuration. Since the programmatic configuration is not "
"part of the official Bean Validation specification you will have to get hold "
"of the Hibernate Validator specific configuration instance. See <xref "
"linkend=\"example-hibernate-specific-config\"/>."
msgstr ""
"一旦你创建(和配置)好了<classname>ConstraintMapping</classname>, 你需要把它传"
"递进configuration, 从而创建validator. 因为这个编程方式定义约束的特性不是Bean "
"Validation规范的一部分, 所以你只能通过获取内部的Hibernate Validator的"
"configuration对象来实现. 请参考<xref linkend=\"example-hibernate-specific-"
"config\"/>."

#. Tag: title
#: programmaticapi.xml:87
#, no-c-format
msgid "Creating a Hibernate Validator specific configuration"
msgstr "创建Hibernate Validator特有的属性"

#. Tag: programlisting
#: programmaticapi.xml:89
#, 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 ""
"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();"
