Java Mailing List Archive

http://www.gg3721.com/

Home » Hibernate Commits List »

[hibernate-commits] Hibernate SVN: r20218 -
 validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules.

hibernate-commits

2010-08-22


Author LoginPost Reply
Author: stliu
Date: 2010-08-22 11:49:15 -0400 (Sun, 22 Aug 2010)
New Revision: 20218

Modified:
 validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules/customconstraints.po
 validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules/xmlconfiguration.po
Log:
HV-351 translation

Modified: validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules/customconstraints.po
===================================================================
--- validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules/customconstraints.po  2010-08-22 10:28:50 UTC (rev 20217)
+++ validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules/customconstraints.po  2010-08-22 15:49:15 UTC (rev 20218)
@@(protected) @@
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2010-07-06 14:46+0000\n"
-"PO-Revision-Date: 2010-08-20 00:04+0830\n"
+"PO-Revision-Date: 2010-08-21 02:16+0830\n"
"Last-Translator: Strong Liu <stliu@(protected)"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
@@(protected) @@
#: customconstraints.xml:74
#, no-c-format
msgid "Now we can define the actual constraint annotation. If you've never designed an annotation before, this may look a bit scary, but actually it's not that hard:"
-msgstr ""
+msgstr "现在我们可以来定义真正的约束标注了. 如果你以前没有创建过标注(annotation)的话,那么这个可能看起来有点吓人, 可是其实没有那么难的 :)"

#. Tag: title
#: customconstraints.xml:79
#, no-c-format
msgid "Defining CheckCase constraint annotation"
-msgstr ""
+msgstr "定义一个CheckCase的约束标注"

#. Tag: programlisting
#: customconstraints.xml:81
@@(protected) @@
"\n"
"}"
msgstr ""
+"package com.mycompany;\n"
+"\n"
+"import static java.lang.annotation.ElementType.*;\n"
+"import static java.lang.annotation.RetentionPolicy.*;\n"
+"\n"
+"import java.lang.annotation.Documented;\n"
+"import java.lang.annotation.Retention;\n"
+"import java.lang.annotation.Target;\n"
+"\n"
+"import javax.validation.Constraint;\n"
+"import javax.validation.Payload;\n"
+"\n"
+"@(protected)"
+"@(protected)"
+"@(protected)"
+"@(protected)"
+"public @interface CheckCase {\n"
+"\n"
+"   String message() default \"{com.mycompany.constraints.checkcase}\";\n"
+"\n"
+"   Class&lt;?&gt;[] groups() default {};\n"
+"\n"
+"   Class&lt;? extends Payload&gt;[] payload() default {};\n"
+"   \n"
+"   CaseMode value();\n"
+"\n"
+"}"

#. Tag: para
#: customconstraints.xml:84
#, no-c-format
msgid "An annotation type is defined using the <code>@(protected)"
-msgstr ""
+msgstr "一个标注(annotation) 是通过<code>@(protected)"

#. Tag: para
#: customconstraints.xml:91
#, no-c-format
msgid "an attribute <property>message</property> that returns the default key for creating error messages in case the constraint is violated"
-msgstr ""
+msgstr "<property>message</property>属性, 这个属性被用来定义默认得消息模版, 当这个约束条件被验证失败的时候,通过此属性来输出错误信息."

#. Tag: para
#: customconstraints.xml:97
#, no-c-format
msgid "an attribute <property>groups</property> that allows the specification of validation groups, to which this constraint belongs (see <xref linkend=\"validator-usingvalidator-validationgroups\"/>). This must default to an empty array of type <classname>Class&lt;?&gt;</classname>."
-msgstr ""
+msgstr "<property>groups</property> 属性, 用于指定这个约束条件属于哪(些)个校验组(请参考<xref linkend=\"validator-usingvalidator-validationgroups\"/>). 这个的默认值必须是<classname>Class&lt;?&gt;</classname>类型到空到数组."

#. Tag: para
#: customconstraints.xml:105
#, no-c-format
msgid "an attribute <classname>payload</classname> that can be used by clients of the Bean Validation API to assign custom payload objects to a constraint. This attribute is not used by the API itself."
-msgstr ""
+msgstr "<classname>payload</classname> 属性, Bean Validation API 的使用者可以通过此属性来给约束条件指定严重级别. 这个属性并不被API自身所使用."

#. Tag: para
#: customconstraints.xml:109
#, no-c-format
msgid "An example for a custom payload could be the definition of a severity."
-msgstr ""
+msgstr "通过payload属性来指定默认错误严重级别的示例"

#. Tag: programlisting
#: customconstraints.xml:112
@@(protected) @@
"   // ...\n"
"}"
msgstr ""
+"public class Severity {\n"
+"   public static class Info extends Payload {};\n"
+"   public static class Error extends Payload {};\n"
+"}\n"
+"\n"
+"public class ContactDetails {\n"
+"   @NotNull(message=\"Name is mandatory\", payload=Severity.Error.class)\n"
+"   private String name;\n"
+"\n"
+"   @NotNull(message=\"Phone number not specified, but not mandatory\", payload=Severity.Info.class)\n"
+"   private String phoneNumber;\n"
+"\n"
+"   // ...\n"
+"}"

#. Tag: para
#: customconstraints.xml:114
#, no-c-format
msgid "Now a client can after the validation of a <classname>ContactDetails</classname> instance access the severity of a constraint using <methodname>ConstraintViolation.getConstraintDescriptor().getPayload()</methodname> and adjust its behaviour depending on the severity."
-msgstr ""
+msgstr "这样, 在校验完一个<classname>ContactDetails</classname> 的示例之后, 你就可以通过调用<methodname>ConstraintViolation.getConstraintDescriptor().getPayload()</methodname>来得到之前指定到错误级别了,并且可以根据这个信息来决定接下来到行为."

#. Tag: para
#: customconstraints.xml:123
#, no-c-format
msgid "Besides those three mandatory attributes (<property>message</property>, <property>groups</property> and <property>payload</property>) we add another one allowing for the required case mode to be specified. The name <property>value</property> is a special one, which can be omitted upon using the annotation, if it is the only attribute specified, as e.g. in <code>@(protected)>."
-msgstr ""
+msgstr "除了这三个强制性要求的属性(<property>message</property>, <property>groups</property> 和 <property>payload</property>) 之外, 我们还添加了一个属性用来指定所要求到字符串模式. 此属性的名称<property>value</property>在annotation的定义中比较特殊, 如果只有这个属性被赋值了的话, 那么, 在使用此annotation到时候可以忽略此属性名称, 即<code>@(protected)>."

#. Tag: para
#: customconstraints.xml:131
#, no-c-format
msgid "In addition we annotate the annotation type with a couple of so-called meta annotations:"
-msgstr ""
+msgstr "另外, 我们还给这个annotation标注了一些(所谓的) 元标注( 译注: 或\"元模型信息\"?, \"meta annotatioins\"): "

#. Tag: para
#: customconstraints.xml:136
#, no-c-format
msgid "<code>@(protected).)"
-msgstr ""
+msgstr "<code>@(protected)."

#. Tag: para
#: customconstraints.xml:142
#, no-c-format
msgid "<code>@(protected)"
-msgstr ""
+msgstr "<code>@(protected)."

#. Tag: para
#: customconstraints.xml:148
#, no-c-format
msgid "<code>@(protected)"
-msgstr ""
+msgstr "<code>@(protected)."

#. Tag: para
#: customconstraints.xml:154
#, no-c-format
msgid "<code>@(protected)"
-msgstr ""
+msgstr "<code>@(protected)."

#. Tag: title
#: customconstraints.xml:162
#, no-c-format
msgid "The constraint validator"
-msgstr ""
+msgstr "约束校验器"

#. Tag: para
#: customconstraints.xml:165
#, no-c-format
msgid "Next, we need to implement a constraint validator, that's able to validate elements with a <classname>@(protected):"
-msgstr ""
+msgstr "接下来, 我们需要实现一个约束验证器, 它是被用来校验应用了<classname>@(protected)."

#. Tag: title
#: customconstraints.xml:171
#, no-c-format
msgid "Implementing a constraint validator for the constraint <classname>CheckCase</classname>"
-msgstr ""
+msgstr "约束条件<classname>CheckCase</classname>的验证器"

#. Tag: programlisting
#: customconstraints.xml:174
@@(protected) @@
"\n"
"}"
msgstr ""
+"package com.mycompany;\n"
+"\n"
+"import javax.validation.ConstraintValidator;\n"
+"import javax.validation.ConstraintValidatorContext;\n"
+"\n"
+"public class CheckCaseValidator implements ConstraintValidator&lt;CheckCase, String&gt; {\n"
+"\n"
+"   private CaseMode caseMode;\n"
+"\n"
+"   public void initialize(CheckCase constraintAnnotation) {\n"
+"     this.caseMode = constraintAnnotation.value();\n"
+"   }\n"
+"\n"
+"   public boolean isValid(String object, ConstraintValidatorContext constraintContext) {\n"
+"\n"
+"     if (object == null)\n"
+"        return true;\n"
+"\n"
+"     if (caseMode == CaseMode.UPPER)\n"
+"        return object.equals(object.toUpperCase());\n"
+"     else\n"
+"        return object.equals(object.toLowerCase());\n"
+"   }\n"
+"\n"
+"}"

#. Tag: para
#: customconstraints.xml:177
#, no-c-format
msgid "The <classname>ConstraintValidator</classname> interface defines two type parameters, which we set in our implementation. The first one specifies the annotation type to be validated (in our example <classname>CheckCase</classname>), the second one the type of elements, which the validator can handle (here <classname>String</classname>)."
-msgstr ""
+msgstr "<classname>ConstraintValidator</classname>定义了两个泛型参数, 第一个是这个校验器所服务到标注类型(在我们的例子中即<classname>CheckCase</classname>), 第二个这个校验器所支持到被校验元素到类型 (即<classname>String</classname>)."

#. Tag: para
#: customconstraints.xml:184
#, no-c-format
msgid "In case a constraint annotation is allowed at elements of different types, a <classname>ConstraintValidator</classname> for each allowed type has to be implemented and registered at the constraint annotation as shown above."
-msgstr ""
+msgstr "如果一个约束标注支持多种类型到被校验元素的话, 那么需要为每个所支持的类型定义一个<classname>ConstraintValidator</classname>,并且注册到约束标注中."

#. Tag: para
#: customconstraints.xml:189
#, no-c-format
msgid "The implementation of the validator is straightforward. The <methodname>initialize()</methodname> method gives us access to the attribute values of the annotation to be validated. In the example we store the <classname>CaseMode</classname> in a field of the validator for further usage."
-msgstr ""
+msgstr "这个验证器的实现就很平常了, <methodname>initialize()</methodname> 方法传进来一个所要验证的标注类型的实例, 在本例中, 我们通过此实例来获取其value属性的值,并将其保存为<classname>CaseMode</classname>类型的成员变量供下一步使用."

#. Tag: para
#: customconstraints.xml:195
#, no-c-format
msgid "In the <methodname>isValid()</methodname> method we implement the logic, that determines, whether a <classname>String</classname> is valid according to a given <classname>@(protected)."
-msgstr ""
+msgstr "<methodname>isValid()</methodname>是实现真正的校验逻辑的地方, 判断一个给定的<classname>String</classname>对于<classname>@(protected)."

#. Tag: title
#: customconstraints.xml:205
#, no-c-format
msgid "The ConstraintValidatorContext"
-msgstr ""
+msgstr "ConstraintValidatorContext"

#. Tag: para
#: customconstraints.xml:207
#, no-c-format
msgid "relies on the default error message generation by just returning <constant>true</constant> or <constant>false</constant> from the <methodname>isValid</methodname> call. Using the passed <classname>ConstraintValidatorContext</classname> object it is possible to either add additional error messages or completely disable the default error message generation and solely define custom error messages. The <classname>ConstraintValidatorContext</classname> API is modeled as fluent interface and is best demonstrated with an example:"
-msgstr ""
+msgstr "中的<methodname>isValid</methodname>使用了约束条件中定义的错误消息模板, 然后返回一个<constant>true</constant> 或者 <constant>false</constant>. 通过使用传入的<classname>ConstraintValidatorContext</classname>对象, 我们还可以给约束条件中定义的错误信息模板来添加额外的信息或者完全创建一个新的错误信息模板. "

#. Tag: title
#: customconstraints.xml:219
#, no-c-format
msgid "Use of ConstraintValidatorContext to define custom error messages"
-msgstr ""
+msgstr "使用ConstraintValidatorContext来自定义错误信息"

#. Tag: programlisting
#: customconstraints.xml:222
@@(protected) @@
"\n"
"}"
msgstr ""
+"package com.mycompany;\n"
+"\n"
+"import javax.validation.ConstraintValidator;\n"
+"import javax.validation.ConstraintValidatorContext;\n"
+"\n"
+"public class CheckCaseValidator implements ConstraintValidator&lt;CheckCase, String&gt; {\n"
+"\n"
+"   private CaseMode caseMode;\n"
+"\n"
+"   public void initialize(CheckCase constraintAnnotation) {\n"
+"     this.caseMode = constraintAnnotation.value();\n"
+"   }\n"
+"\n"
+"   public boolean isValid(String object, ConstraintValidatorContext constraintContext) {\n"
+"\n"
+"     if (object == null)\n"
+"        return true;\n"
+"     \n"
+"     boolean isValid;\n"
+"     if (caseMode == CaseMode.UPPER) {\n"
+"        isValid = object.equals(object.toUpperCase());\n"
+"     }\n"
+"     else {\n"
+"        isValid = object.equals(object.toLowerCase());\n"
+"     }\n"
+"     \n"
+"     if(!isValid) {\n"
+"        constraintContext.disableDefaultConstraintViolation();\n"
+"        constraintContext.buildConstraintViolationWithTemplate( \"{com.mycompany.constraints.CheckCase.message}\" ).addConstraintViolation();\n"
+"     }\n"
+"     return result;\n"
+"   }\n"
+"\n"
+"}"

#. Tag: para
#: customconstraints.xml:225
#, no-c-format
msgid "shows how you can disable the default error message generation and add a custom error message using a specified message template. In this example the use of the <classname>ConstraintValidatorContext</classname> results in the same error message as the default error message generation."
-msgstr ""
+msgstr "演示了如果创建一个新的错误信息模板来替换掉约束条件中定义的默认的. 在本例中, 实际上通过调用<classname>ConstraintValidatorContext</classname>达到了一个使用默认消息模板的效果."

#. Tag: para
#: customconstraints.xml:231
#, no-c-format
msgid "It is important to end each new constraint violation with <methodname>addConstraintViolation</methodname>. Only after that the new constraint violation will be created."
-msgstr ""
+msgstr "在创建新的constraint violation的时候一定要记得调用<methodname>addConstraintViolation</methodname>, 只有这样, 这个新的constraint violation才会被真正的创建."

#. Tag: para
#: customconstraints.xml:236
@@(protected) @@
"   return isValid;\n"
"}"
msgstr ""
+"public boolean isValid(Group group, ConstraintValidatorContext constraintValidatorContext) {\n"
+"   boolean isValid = false;\n"
+"   ...\n"
+"\n"
+"   if(!isValid) {\n"
+"     constraintValidatorContext\n"
+"        .buildConstraintViolationWithTemplate( \"{my.custom.template}\" )\n"
+"        .addNode( \"myProperty\" ).addConstraintViolation();\n"
+"   }\n"
+"   return isValid;\n"
+"}"

#. Tag: title
#: customconstraints.xml:254
#, no-c-format
msgid "The error message"
-msgstr ""
+msgstr "校验错误信息"

#. Tag: para
#: customconstraints.xml:256
#, no-c-format
msgid "Finally we need to specify the error message, that shall be used, in case a <classname>@(protected)\"/>)"
-msgstr ""
+msgstr "最后, 我们还需要指定如果<classname>@(protected)."

#. Tag: title
#: customconstraints.xml:263
#, no-c-format
msgid "Defining a custom error message for the <classname>CheckCase</classname> constraint"
-msgstr ""
+msgstr "为<classname>CheckCase</classname>约束定义一个错误信息"

#. Tag: programlisting
#: customconstraints.xml:266
#, no-c-format
msgid "com.mycompany.constraints.CheckCase.message=Case mode must be {value}."
-msgstr ""
+msgstr "com.mycompany.constraints.CheckCase.message=Case mode must be {value}."

#. Tag: para
#: customconstraints.xml:269
#, no-c-format
msgid "If a validation error occurs, the validation runtime will use the default value, that we specified for the message attribute of the <classname>@(protected)."
-msgstr ""
+msgstr "如果发现校验错误了的话, 你所使用的Bean Validation的实现会用我们定义在<classname>@(protected)."

#. Tag: title
#: customconstraints.xml:276
#, no-c-format
msgid "Using the constraint"
-msgstr ""
+msgstr "应用约束条件"

#. Tag: para
#: customconstraints.xml:278
#, no-c-format
msgid "Now that our first custom constraint is completed, we can use it in the <classname>Car</classname> class from the <xref linkend=\"validator-gettingstarted\"/> chapter to specify that the <property>licensePlate</property> field shall only contain upper-case strings:"
-msgstr ""
+msgstr "现在我们已经有了一个自定义的约束条件了, 我们可以把它用在<xref linkend=\"validator-gettingstarted\"/>中的<classname>Car</classname>类上, 来校验此类的<property>licensePlate</property>属性的值是否全都是大写字母."

#. Tag: title
#: customconstraints.xml:285
#, no-c-format
msgid "Applying the <classname>CheckCase</classname> constraint"
-msgstr ""
+msgstr "应用<classname>CheckCase</classname>约束条件"

#. Tag: programlisting
#: customconstraints.xml:288
@@(protected) @@
"\n"
"}"
msgstr ""
+"package com.mycompany;\n"
+"\n"
+"import javax.validation.constraints.Min;\n"
+"import javax.validation.constraints.NotNull;\n"
+"import javax.validation.constraints.Size;\n"
+"\n"
+"public class Car {\n"
+"\n"
+"   @NotNull\n"
+"   private String manufacturer;\n"
+"\n"
+"   @NotNull\n"
+"   @Size(min = 2, max = 14)\n"
+"   @CheckCase(CaseMode.UPPER)\n"
+"   private String licensePlate;\n"
+"\n"
+"   @Min(2)\n"
+"   private int seatCount;\n"
+"   \n"
+"   public Car(String manufacturer, String licencePlate, int seatCount) {\n"
+"\n"
+"     this.manufacturer = manufacturer;\n"
+"     this.licensePlate = licencePlate;\n"
+"     this.seatCount = seatCount;\n"
+"   }\n"
+"\n"
+"   //getters and setters ...\n"
+"\n"
+"}"

#. Tag: para
#: customconstraints.xml:291
#, no-c-format
msgid "Finally let's demonstrate in a little test that the <classname>@(protected):"
-msgstr ""
+msgstr "最后,让我们用一个简单的测试来检测<classname>@(protected):"

#. Tag: title
#: customconstraints.xml:296
#, no-c-format
msgid "Testcase demonstrating the <classname>CheckCase</classname> validation"
-msgstr ""
+msgstr "演示<classname>CheckCase</classname>的验证过程"

#. Tag: programlisting
#: customconstraints.xml:299
@@(protected) @@
"   }\n"
"}"
msgstr ""
+"package com.mycompany;\n"
+"\n"
+"import static org.junit.Assert.*;\n"
+"\n"
+"import java.util.Set;\n"
+"\n"
+"import javax.validation.ConstraintViolation;\n"
+"import javax.validation.Validation;\n"
+"import javax.validation.Validator;\n"
+"import javax.validation.ValidatorFactory;\n"
+"\n"
+"import org.junit.BeforeClass;\n"
+"import org.junit.Test;\n"
+"\n"
+"public class CarTest {\n"
+"\n"
+"   private static Validator validator;\n"
+"\n"
+"   @BeforeClass\n"
+"   public static void setUp() {\n"
+"     ValidatorFactory factory = Validation.buildDefaultValidatorFactory();\n"
+"     validator = factory.getValidator();\n"
+"   }\n"
+"\n"
+"   @Test\n"
+"   public void testLicensePlateNotUpperCase() {\n"
+"\n"
+"     Car car = new Car(\"Morris\", \"dd-ab-123\", 4);\n"
+"\n"
+"     Set&lt;ConstraintViolation&lt;Car&gt;&gt; constraintViolations =\n"
+"        validator.validate(car);\n"
+"     assertEquals(1, constraintViolations.size());\n"
+"     assertEquals(\n"
+"        \"Case mode must be UPPER.\", \n"
+"        constraintViolations.iterator().next().getMessage());\n"
+"   }\n"
+"\n"
+"   @Test\n"
+"   public void carIsValid() {\n"
+"\n"
+"     Car car = new Car(\"Morris\", \"DD-AB-123\", 4);\n"
+"\n"
+"     Set&lt;ConstraintViolation&lt;Car&gt;&gt; constraintViolations =\n"
+"        validator.validate(car);\n"
+"\n"
+"     assertEquals(0, constraintViolations.size());\n"
+"   }\n"
+"}"

#. Tag: title
#: customconstraints.xml:305
#, no-c-format
msgid "Constraint composition"
-msgstr ""
+msgstr "约束条件组合"

#. Tag: para
#: customconstraints.xml:307
#, no-c-format
msgid "Looking at the <property>licensePlate</property> field of the <classname>Car</classname> class in <xref linkend=\"example-car-with-checkcase\"/>, we see three constraint annotations already. In complexer scenarios, where even more constraints could be applied to one element, this might become a bit confusing easily. Furthermore, if we had a <property>licensePlate</property> field in another class, we would have to copy all constraint declarations to the other class as well, violating the DRY principle."
-msgstr ""
+msgstr "在<xref linkend=\"example-car-with-checkcase\"/>中我们可以看到, 类<classname>Car</classname>的<property>licensePlate</property>属性上定义了三个约束条件. 在某些复杂的场景中, 可能还会有更多的约束条件被定义到同一个元素上面, 这可能会让代码看起来有些复杂, 另外, 如果在另外的类里面还有一个<property>licensePlate</property>属性, 我们可能还要把这些约束条件再拷贝到这个属性上, 但是这样做又违反了 DRY 原则."

#. Tag: para
#: customconstraints.xml:316
#, no-c-format
msgid "This problem can be tackled using compound constraints. In the following we create a new constraint annotation <classname>@(protected)>:"
-msgstr ""
+msgstr "这个问题可以通过使用组合约束条件来解决. 接下来让我们来创建一个新的约束标注<classname>@(protected)>:"

#. Tag: title
#: customconstraints.xml:323
#, no-c-format
msgid "Creating a composing constraint <classname>ValidLicensePlate</classname>"
-msgstr ""
+msgstr "创建一个约束条件组合<classname>ValidLicensePlate</classname>"

#. Tag: programlisting
#: customconstraints.xml:326
@@(protected) @@
"\n"
"}"
msgstr ""
+"package com.mycompany;\n"
+"\n"
+"import static java.lang.annotation.ElementType.*;\n"
+"import static java.lang.annotation.RetentionPolicy.*;\n"
+"\n"
+"import java.lang.annotation.Documented;\n"
+"import java.lang.annotation.Retention;\n"
+"import java.lang.annotation.Target;\n"
+"\n"
+"import javax.validation.Constraint;\n"
+"import javax.validation.Payload;\n"
+"import javax.validation.constraints.NotNull;\n"
+"import javax.validation.constraints.Size;\n"
+"\n"
+"@(protected)"
+"@(protected)"
+"@(protected)"
+"@(protected)"
+"@(protected)"
+"@(protected)"
+"@(protected)"
+"public @interface ValidLicensePlate {\n"
+"\n"
+"   String message() default \"{com.mycompany.constraints.validlicenseplate}\";\n"
+"\n"
+"   Class&lt;?&gt;[] groups() default {};\n"
+"\n"
+"   Class&lt;? extends Payload&gt;[] payload() default {};\n"
+"\n"
+"}"

#. Tag: para
#: customconstraints.xml:329
#, no-c-format
msgid "To do so, we just have to annotate the constraint declaration with its comprising constraints (btw. that's exactly why we allowed annotation types as target for the <classname>@(protected)."
-msgstr ""
+msgstr "我们只需要把要组合的约束标注在这个新的类型上加以声明 (注: 这正是我们为什么把annotation types作为了<classname>@(protected)."

#. Tag: para
#: customconstraints.xml:337
#, no-c-format
msgid "Using the new compound constraint at the <property>licensePlate</property> field now is fully equivalent to the previous version, where we declared the three constraints directly at the field itself:"
-msgstr ""
+msgstr "现在, 在<property>licensePlate</property>属性上使用这个新定义的\"约束条件\" (其实是个组合) 和之前在其上声明那三个约束条件是一样的效果了."

#. Tag: title
#: customconstraints.xml:343
#, no-c-format
msgid "Application of composing constraint <classname>ValidLicensePlate</classname>"
-msgstr ""
+msgstr "使用<classname>ValidLicensePlate</classname>组合约束"

#. Tag: programlisting
#: customconstraints.xml:346
@@(protected) @@
"\n"
"}"
msgstr ""
+"package com.mycompany;\n"
+"\n"
+"public class Car {\n"
+"\n"
+"   @ValidLicensePlate\n"
+"   private String licensePlate;\n"
+"\n"
+"   //...\n"
+"\n"
+"}"

#. Tag: para
#: customconstraints.xml:349
@@(protected) @@
#: customconstraints.xml:359
#, no-c-format
msgid "Usage of <classname>@(protected)>"
-msgstr ""
+msgstr "<classname>@(protected)"

#. Tag: programlisting
#: customconstraints.xml:361
@@(protected) @@
"\n"
"}"
msgstr ""
+"//...\n"
+"@(protected)"
+"public @interface ValidLicensePlate {\n"
+"\n"
+"   String message() default \"{com.mycompany.constraints.validlicenseplate}\";\n"
+"\n"
+"   Class&lt;?&gt;[] groups() default {};\n"
+"\n"
+"   Class&lt;? extends Payload&gt;[] payload() default {};\n"
+"\n"
+"}"


Modified: validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules/xmlconfiguration.po
===================================================================
--- validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules/xmlconfiguration.po  2010-08-22 10:28:50 UTC (rev 20217)
+++ validator/trunk/hibernate-validator/src/main/docbook/zh-CN/modules/xmlconfiguration.po  2010-08-22 15:49:15 UTC (rev 20218)
@@(protected) @@
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2010-07-06 14:46+0000\n"
-"PO-Revision-Date: 2010-07-06 14:46+0000\n"
-"Last-Translator: Automatically generated\n"
+"PO-Revision-Date: 2010-08-22 23:44+0830\n"
+"Last-Translator: Strong Liu <stliu@(protected)"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@(protected) @@
#: xmlconfiguration.xml:25
#, no-c-format
msgid "XML configuration"
-msgstr ""
+msgstr "XML configuration"

#. Tag: filename
#: xmlconfiguration.xml:28
#, no-c-format
msgid "<filename>validation.xml</filename>"
-msgstr ""
+msgstr "<filename>validation.xml</filename>"

#. Tag: para
#: xmlconfiguration.xml:30
#, no-c-format
-msgid ""
-"The key to enable XML configuration for Hibernate Validator is the file "
-"<filename>validation.xml</filename>. If this file exists in the classpath "
-"its configuration will be applied when the <classname>ValidationFactory</"
-"classname> gets created. <xref linkend=\"image-validation-configuration\"/> "
-"shows a model view of the xsd <filename>valiation.xml</filename> has to "
-"adhere to."
-msgstr ""
+msgid "The key to enable XML configuration for Hibernate Validator is the file <filename>validation.xml</filename>. If this file exists in the classpath its configuration will be applied when the <classname>ValidationFactory</classname> gets created. <xref linkend=\"image-validation-configuration\"/> shows a model view of the xsd <filename>valiation.xml</filename> has to adhere to."
+msgstr "我们可以使用<filename>validation.xml</filename>来对Hibernate Validator进行配置. <classname>ValidationFactory</classname>在初始化的时候会在类路径下寻找此文件,如果找到的话,就会应用其中定义的配置信息. <xref linkend=\"image-validation-configuration\"/>显示了<filename>valiation.xml</filename>的xsd模型."

#. Tag: title
#: xmlconfiguration.xml:37
#, no-c-format
msgid "validation-configuration-1.0.xsd"
-msgstr ""
+msgstr "validation-configuration-1.0.xsd"

#. Tag: para
#: xmlconfiguration.xml:52
#, no-c-format
-msgid ""
-"shows the several configuration options of <filename>validation.xml</"
-"filename>."
-msgstr ""
+msgid "shows the several configuration options of <filename>validation.xml</filename>."
+msgstr "列出了<filename>validation.xml</filename>中的一些常用的配置项."

#. Tag: title
#: xmlconfiguration.xml:56
#, no-c-format
msgid "<title>validation.xml</title>"
-msgstr ""
+msgstr "<title>validation.xml</title>"

#. Tag: programlisting
#: xmlconfiguration.xml:58
#, no-c-format
msgid ""
-"&lt;validation-config xmlns=\"http://jboss.org/xml/ns/javax/validation/"
-"configuration\"\n"
+"&lt;validation-config xmlns=\"http://jboss.org/xml/ns/javax/validation/configuration\"\n"
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
-" xsi:schemaLocation=\"http://jboss.org/xml/ns/javax/validation/configuration"
-"\"&gt;\n"
-"   &lt;default-provider&gt;org.hibernate.validator.HibernateValidator&lt;/"
-"default-provider&gt;\n"
-"   &lt;message-interpolator&gt;org.hibernate.validator.engine."
-"ResourceBundleMessageInterpolator&lt;/message-interpolator&gt;\n"
-"   &lt;traversable-resolver&gt;org.hibernate.validator.engine.resolver."
-"DefaultTraversableResolver&lt;/traversable-resolver&gt;\n"
-"   &lt;constraint-validator-factory&gt;org.hibernate.validator.engine."
-"ConstraintValidatorFactoryImpl&lt;/constraint-validator-factory&gt;\n"
-"   &lt;constraint-mapping&gt;/constraints-car.xml&lt;/constraint-"
-"mapping&gt;\n"
+" xsi:schemaLocation=\"http://jboss.org/xml/ns/javax/validation/configuration\"&gt;\n"
+"   &lt;default-provider&gt;org.hibernate.validator.HibernateValidator&lt;/default-provider&gt;\n"
+"   &lt;message-interpolator&gt;org.hibernate.validator.engine.ResourceBundleMessageInterpolator&lt;/message-interpolator&gt;\n"
+"   &lt;traversable-resolver&gt;org.hibernate.validator.engine.resolver.DefaultTraversableResolver&lt;/traversable-resolver&gt;\n"
+"   &lt;constraint-validator-factory&gt;org.hibernate.validator.engine.ConstraintValidatorFactoryImpl&lt;/constraint-validator-factory&gt;\n"
+"   &lt;constraint-mapping&gt;/constraints-car.xml&lt;/constraint-mapping&gt;\n"
"   &lt;property name=\"prop1\"&gt;value1&lt;/property&gt;\n"
"   &lt;property name=\"prop2\"&gt;value2&lt;/property&gt;\n"
"&lt;/validation-config&gt;"
msgstr ""
+"&lt;validation-config xmlns=\"http://jboss.org/xml/ns/javax/validation/configuration\"\n"
+" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+" xsi:schemaLocation=\"http://jboss.org/xml/ns/javax/validation/configuration\"&gt;\n"
+"   &lt;default-provider&gt;org.hibernate.validator.HibernateValidator&lt;/default-provider&gt;\n"
+"   &lt;message-interpolator&gt;org.hibernate.validator.engine.ResourceBundleMessageInterpolator&lt;/message-interpolator&gt;\n"
+"   &lt;traversable-resolver&gt;org.hibernate.validator.engine.resolver.DefaultTraversableResolver&lt;/traversable-resolver&gt;\n"
+"   &lt;constraint-validator-factory&gt;org.hibernate.validator.engine.ConstraintValidatorFactoryImpl&lt;/constraint-validator-factory&gt;\n"
+"   &lt;constraint-mapping&gt;/constraints-car.xml&lt;/constraint-mapping&gt;\n"
+"   &lt;property name=\"prop1\"&gt;value1&lt;/property&gt;\n"
+"   &lt;property name=\"prop2\"&gt;value2&lt;/property&gt;\n"
+"&lt;/validation-config&gt;"

#. Tag: para
#: xmlconfiguration.xml:62
#, no-c-format
-msgid ""
-"There can only be one <filename>validation.xml</filename> in the classpath. "
-"If more than one is found an exception is thrown."
-msgstr ""
+msgid "There can only be one <filename>validation.xml</filename> in the classpath. If more than one is found an exception is thrown."
+msgstr "类路径下面只能有一个<filename>validation.xml</filename>, 如果超过一个的话,会抛出异常."

#. Tag: para
#: xmlconfiguration.xml:66
#, no-c-format
-msgid ""
-"All settings shown in the <filename>validation.xml</filename> are optional "
-"and in the case of <xref linkend=\"example-validation-xml\"/> show the "
-"defaults used within Hibernate Validator. The node <property>default-"
-"provider</property> allows to choose the Bean Validation provider. This is "
-"useful if there is more than one provider in the classpath. "
-"<property>message-interpolator</property>, <property>traversable-resolver</"
-"property> and <property>constraint-validator-factory</property> allow to "
-"customize the <classname>javax.validation.MessageInterpolator</classname>, "
-"<classname>javax.validation.TraversableResolver</classname> resp. "
-"<classname>javax.validation.ConstraintValidatorFactory</classname>. The same "
-"configuration options are also available programmatically through the "
-"<classname>javax.validation.Configuration</classname>. In fact XML "
-"configuration will be overridden by values explicitly specified via the API. "
-"It is even possible to ignore the XML configuration completely via "
-"<methodname> Configuration.ignoreXmlConfiguration()</methodname>. See also "
-"<xref linkend=\"validator-bootstrapping\"/>."
-msgstr ""
+msgid "All settings shown in the <filename>validation.xml</filename> are optional and in the case of <xref linkend=\"example-validation-xml\"/> show the defaults used within Hibernate Validator. The node <property>default-provider</property> allows to choose the Bean Validation provider. This is useful if there is more than one provider in the classpath. <property>message-interpolator</property>, <property>traversable-resolver</property> and <property>constraint-validator-factory</property> allow to customize the <classname>javax.validation.MessageInterpolator</classname>, <classname>javax.validation.TraversableResolver</classname> resp. <classname>javax.validation.ConstraintValidatorFactory</classname>. The same configuration options are also available programmatically through the <classname>javax.validation.Configuration</classname>. In fact XML configuration will be overridden by values explicitly specified via the API. It is even possible to ignore the XML configuration!
completely via <methodname> Configuration.ignoreXmlConfiguration()</methodname>. See also <xref linkend=\"validator-bootstrapping\"/>."
+msgstr "<filename>validation.xml</filename>中所有的配置信息都是可选的, <xref linkend=\"example-validation-xml\"/>中就是列出了Hibernate Validator中的默认值. 如果类路径当中存在有多个Bean Validation的实现的话, 那么可以通过<property>default-provider</property>节点指定使用那个Bean Validation的实现. <property>message-interpolator</property>, <property>traversable-resolver</property> 和 <property>constraint-validator-factory</property>可以用来指定自定义的<classname>javax.validation.MessageInterpolator</classname>, <classname>javax.validation.TraversableResolver</classname>和<classname>javax.validation.ConstraintValidatorFactory</classname>. 同样的, 这些配置信息也可以通过编程的方式调用<classname>javax.validation.Configuration</classname>来实现. 另外, 你可以通过API的方式来重写xml中的配置信息, 也可以通过调用<methodname> Configuration.ignoreXmlConfiguration()</method!
name>来完全的忽略掉xml的配置信息. 请参考<xref linkend=\"validator-bootstrapping\"/>."

#. Tag: para
#: xmlconfiguration.xml:84
#, no-c-format
-msgid ""
-"Via the <property>constraint-mapping</property> you can list an arbitrary "
-"number of additional XML files containing the actual constraint "
-"configuration. See <xref linkend=\"section-mapping-constraints\"/>."
-msgstr ""
+msgid "Via the <property>constraint-mapping</property> you can list an arbitrary number of additional XML files containing the actual constraint configuration. See <xref linkend=\"section-mapping-constraints\"/>."
+msgstr "你可以增加若干个<property>constraint-mapping</property>节点,在每个里面列出一个额外的xml文件用来定义约束规则, 具体请参考<xref linkend=\"section-mapping-constraints\"/>."

#. Tag: para
#: xmlconfiguration.xml:88
#, no-c-format
-msgid ""
-"Last but not least, you can specify provider specific properties via the "
-"<property>property</property> nodes. Hibernate Validator does currently not "
-"make use of any custom properties."
-msgstr ""
+msgid "Last but not least, you can specify provider specific properties via the <property>property</property> nodes. Hibernate Validator does currently not make use of any custom properties."
+msgstr "最后, 你可以通过<property>property</property>来定义各个Bean Validation 实现专属的属性. Hibernate Validator当前并没有使用任何特定的属性."

#. Tag: title
#: xmlconfiguration.xml:94
#, no-c-format
msgid "Mapping constraints"
-msgstr ""
+msgstr "映射约束"

#. Tag: para
#: xmlconfiguration.xml:96
#, no-c-format
-msgid ""
-"Expressing constraints in XML is possible via files adhering to the xsd seen "
-"in <xref linkend=\"image-mapping-configuration\"/>. Note that these mapping "
-"files are only processed if listed via <property>constraint-mapping</"
-"property> in your <filename>validation.xml</filename>."
-msgstr ""
+msgid "Expressing constraints in XML is possible via files adhering to the xsd seen in <xref linkend=\"image-mapping-configuration\"/>. Note that these mapping files are only processed if listed via <property>constraint-mapping</property> in your <filename>validation.xml</filename>."
+msgstr "我们也可以通过xml来定义约束条件, 只需要这个xml符合<xref linkend=\"image-mapping-configuration\"/>中所定义的规范. 需要注意的是, 你必须把xml定义的约束列在<filename>validation.xml</filename>的<property>constraint-mapping</property>节点中才能得到处理."

#. Tag: title
#: xmlconfiguration.xml:103
#, no-c-format
msgid "validation-mapping-1.0.xsd"
-msgstr ""
+msgstr "validation-mapping-1.0.xsd"

#. Tag: para
#: xmlconfiguration.xml:118
#, no-c-format
-msgid ""
-"shows how our classes Car and RentalCar from <xref linkend=\"example-car\"/> "
-"resp. <xref linkend=\"example-rental-car\"/> could be mapped in XML."
-msgstr ""
+msgid "shows how our classes Car and RentalCar from <xref linkend=\"example-car\"/> resp. <xref linkend=\"example-rental-car\"/> could be mapped in XML."
+msgstr "显示了如何通过xml定义的方式来给<xref linkend=\"example-car\"/>中的类Car 以及<xref linkend=\"example-rental-car\"/> 中的RentalCar定义约束条件."

#. Tag: title
#: xmlconfiguration.xml:123
#, no-c-format
msgid "constraints-car.xml"
-msgstr ""
+msgstr "constraints-car.xml"

#. Tag: programlisting
#: xmlconfiguration.xml:125
#, no-c-format
msgid ""
-"&lt;constraint-mappings xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance"
-"\"\n"
-"              xsi:schemaLocation=\"http://jboss.org/xml/ns/javax/"
-"validation/mapping validation-mapping-1.0.xsd\"\n"
-"              xmlns=\"http://jboss.org/xml/ns/javax/validation/mapping"
-"\"&gt;\n"
-"   &lt;default-package&gt;org.hibernate.validator.quickstart&lt;/default-"
-"package&gt;\n"
+"&lt;constraint-mappings xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+"              xsi:schemaLocation=\"http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd\"\n"
+"              xmlns=\"http://jboss.org/xml/ns/javax/validation/mapping\"&gt;\n"
+"   &lt;default-package&gt;org.hibernate.validator.quickstart&lt;/default-package&gt;\n"
"   &lt;bean class=\"Car\" ignore-annotations=\"true\"&gt;\n"
"     &lt;field name=\"manufacturer\"&gt;\n"
-"        &lt;constraint annotation=\"javax.validation.constraints.NotNull"
-"\"/&gt;\n"
+"        &lt;constraint annotation=\"javax.validation.constraints.NotNull\"/&gt;\n"
"     &lt;/field&gt;\n"
"     &lt;field name=\"licensePlate\"&gt;\n"
-"        &lt;constraint annotation=\"javax.validation.constraints.NotNull"
-"\"/&gt;\n"
+"        &lt;constraint annotation=\"javax.validation.constraints.NotNull\"/&gt;\n"
"     &lt;/field&gt;\n"
"     &lt;field name=\"seatCount\"&gt;\n"
-"        &lt;constraint annotation=\"javax.validation.constraints.Min"
-"\"&gt;\n"
+"        &lt;constraint annotation=\"javax.validation.constraints.Min\"&gt;\n"
"           &lt;element name=\"value\"&gt;2&lt;/element&gt;\n"
"        &lt;/constraint&gt;\n"
"     &lt;/field&gt;\n"
"     &lt;field name=\"driver\"&gt;\n"
"        &lt;valid/&gt;\n"
"     &lt;/field&gt;\n"
-"     &lt;getter name=\"passedVehicleInspection\" ignore-annotations=\"true"
-"\"&gt;\n"
-"        &lt;constraint annotation=\"javax.validation.constraints."
-"AssertTrue\"&gt;\n"
-"           &lt;message&gt;The car has to pass the vehicle inspection "
-"first&lt;/message&gt;\n"
+"     &lt;getter name=\"passedVehicleInspection\" ignore-annotations=\"true\"&gt;\n"
+"        &lt;constraint annotation=\"javax.validation.constraints.AssertTrue\"&gt;\n"
+"           &lt;message&gt;The car has to pass the vehicle inspection first&lt;/message&gt;\n"
"           &lt;groups&gt;\n"
"             &lt;value&gt;CarChecks&lt;/value&gt;\n"
"           &lt;/groups&gt;\n"
@@(protected) @@
"        &lt;/group-sequence&gt;\n"
"     &lt;/class&gt;\n"
"   &lt;/bean&gt;\n"
-"   &lt;constraint-definition annotation=\"org.mycompany.CheckCase\" include-"
-"existing-validator=\"false\"&gt;\n"
+"   &lt;constraint-definition annotation=\"org.mycompany.CheckCase\" include-existing-validator=\"false\"&gt;\n"
"     &lt;validated-by include-existing-validators=\"false\"&gt;\n"
"        &lt;value&gt;org.mycompany.CheckCaseValidator&lt;/value&gt;\n"
"     &lt;/validated-by&gt;\n"
"   &lt;/constraint-definition&gt;\n"
"&lt;/constraint-mappings&gt;"
msgstr ""
+"&lt;constraint-mappings xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+"              xsi:schemaLocation=\"http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd\"\n"
+"              xmlns=\"http://jboss.org/xml/ns/javax/validation/mapping\"&gt;\n"
+"   &lt;default-package&gt;org.hibernate.validator.quickstart&lt;/default-package&gt;\n"
+"   &lt;bean class=\"Car\" ignore-annotations=\"true\"&gt;\n"
+"     &lt;field name=\"manufacturer\"&gt;\n"
+"        &lt;constraint annotation=\"javax.validation.constraints.NotNull\"/&gt;\n"
+"     &lt;/field&gt;\n"
+"     &lt;field name=\"licensePlate\"&gt;\n"
+"        &lt;constraint annotation=\"javax.validation.constraints.NotNull\"/&gt;\n"
+"     &lt;/field&gt;\n"
+"     &lt;field name=\"seatCount\"&gt;\n"
+"        &lt;constraint annotation=\"javax.validation.constraints.Min\"&gt;\n"
+"           &lt;element name=\"value\"&gt;2&lt;/element&gt;\n"
+"        &lt;/constraint&gt;\n"
+"     &lt;/field&gt;\n"
+"     &lt;field name=\"driver\"&gt;\n"
+"        &lt;valid/&gt;\n"
+"     &lt;/field&gt;\n"
+"     &lt;getter name=\"passedVehicleInspection\" ignore-annotations=\"true\"&gt;\n"
+"        &lt;constraint annotation=\"javax.validation.constraints.AssertTrue\"&gt;\n"
+"           &lt;message&gt;The car has to pass the vehicle inspection first&lt;/message&gt;\n"
+"           &lt;groups&gt;\n"
+"             &lt;value&gt;CarChecks&lt;/value&gt;\n"
+"           &lt;/groups&gt;\n"
+"           &lt;element name=\"max\"&gt;10&lt;/element&gt;\n"
+"        &lt;/constraint&gt;\n"
+"     &lt;/getter&gt;\n"
+"   &lt;/bean&gt;\n"
+"   &lt;bean class=\"RentalCar\" ignore-annotations=\"true\"&gt;\n"
+"     &lt;class ignore-annotations=\"true\"&gt;\n"
+"        &lt;group-sequence&gt;\n"
+"           &lt;value&gt;RentalCar&lt;/value&gt;\n"
+"           &lt;value&gt;CarChecks&lt;/value&gt;\n"
+"        &lt;/group-sequence&gt;\n"
+"     &lt;/class&gt;\n"
+"   &lt;/bean&gt;\n"
+"   &lt;constraint-definition annotation=\"org.mycompany.CheckCase\" include-existing-validator=\"false\"&gt;\n"
+"     &lt;validated-by include-existing-validators=\"false\"&gt;\n"
+"        &lt;value&gt;org.mycompany.CheckCaseValidator&lt;/value&gt;\n"
+"     &lt;/validated-by&gt;\n"
+"   &lt;/constraint-definition&gt;\n"
+"&lt;/constraint-mappings&gt;"

#. Tag: para
#: xmlconfiguration.xml:128
#, no-c-format
-msgid ""
-"The XML configuration is closely mirroring the programmatic API. For this "
-"reason it should suffice to just add some comments. <property>default-"
-"package</property> is used for all fields where a classname is expected. If "
-"the specified class is not fully qualified the configured default package "
-"will be used. Every mapping file can then have several <property>bean</"
-"property> nodes, each describing the constraints on the entity with the "
-"specified class name.<warning> <para>A given entity can only be configured "
-"once across all configuration files. If the same class is configured more "
-"than once an exception is thrown.</para> </warning>Settings <property>ignore-"
-"annotations</property> to true means that constraint annotations placed on "
-"the configured bean are ignored. The default for this value is "
-"<constant>true</constant>. ignore-annotations is also available for the "
-"nodes <property>class</property>, <property>fields</property> and "
-"<property>getter</property>. If not explicitly specified on these levels the "
-"configured <property>bean</property> value applies. Otherwise do the nodes "
-"<property>class</property>, <property>fields</property> and "
-"<property>getter</property> determine on which level the constraints are "
-"placed (see <xref linkend=\"validator-usingvalidator-annotate\"/>). The "
-"<property>constraint</property> node is then used to add a constraint on the "
-"corresponding level. Each constraint definition must define the class via "
-"the annotation attribute. The constraint attributes required by the Bean "
-"Validation specification (<property>message</property>, <property>groups</"
-"property> and <property>payload</property>) have dedicated nodes. All other "
-"constraint specific attributes are configured using the the "
-"<property>element</property> node."
-msgstr ""
+msgid "The XML configuration is closely mirroring the programmatic API. For this reason it should suffice to just add some comments. <property>default-package</property> is used for all fields where a classname is expected. If the specified class is not fully qualified the configured default package will be used. Every mapping file can then have several <property>bean</property> nodes, each describing the constraints on the entity with the specified class name.<warning> <para>A given entity can only be configured once across all configuration files. If the same class is configured more than once an exception is thrown.</para> </warning>Settings <property>ignore-annotations</property> to true means that constraint annotations placed on the configured bean are ignored. The default for this value is <constant>true</constant>. ignore-annotations is also available for the nodes <property>class</property>, <property>fields</property> and <property>getter</property>. If not explic!
itly specified on these levels the configured <property>bean</property> value applies. Otherwise do the nodes <property>class</property>, <property>fields</property> and <property>getter</property> determine on which level the constraints are placed (see <xref linkend=\"validator-usingvalidator-annotate\"/>). The <property>constraint</property> node is then used to add a constraint on the corresponding level. Each constraint definition must define the class via the annotation attribute. The constraint attributes required by the Bean Validation specification (<property>message</property>, <property>groups</property> and <property>payload</property>) have dedicated nodes. All other constraint specific attributes are configured using the the <property>element</property> node."
+msgstr "这个xml的定义基本上和通过编程方式差不多, 所以只需要简单的解释. 其中<property>default-package</property>属性用来定义一个默认的包路径, 如果下面指定的class不是全限定名称的话,会自动加上这个默认的包路径. 每个xml文件都可以包含任意多个<property>bean</property>节点, 每个对应一个要添加约束条件的实体类.<warning> <para>每个实体类只能在所有的xml映射文件中被定义一次, 否则会抛出异常.</para> </warning> 通过添加<property>ignore-annotations</property> 属性并将其设置为<constant>true</constant>可以忽略在对应<property>bean</property>上添加的约束标注信息, 这个属性的默认值就是<constant>true</constant>. <property>ignore-annotations</property> 属性还可以定义在<property>class</property>, <property>fields</property> 和 <property>getter</property>属性上, 如果没有明确指定的话, 那么默认级别是<prop!
erty>bean</property> (可参考 <xref linkend=\"validator-usingvalidator-annotate\"/>). <property>constraint</property> 节点用于添加一个约束条件到其父节点对应的元素上, 并且它需要通过<property>annotation</property>属性来指定需要使用哪个约束条件. 对于每个约束条件中所需要的属性, 其中, 由Bean Validation 规范规定的属性(<property>message</property>, <property>groups</property> 和 <property>payload</property>) 可以通过同名的子节点来定义, 而每个约束条件中自定义的属性, 则需要使用<property>element</property>节点来定义."

#. Tag: para
#: xmlconfiguration.xml:156
#, no-c-format
-msgid ""
-"The class node also allows to reconfigure the default group sequence (see "
-"<xref linkend=\"section-default-group-class\"/>) via the <property>group-"
-"sequence</property> node."
-msgstr ""
+msgid "The class node also allows to reconfigure the default group sequence (see <xref linkend=\"section-default-group-class\"/>) via the <property>group-sequence</property> node."
+msgstr "<property>class</property>节点同样支持通过<property>group-sequence</property>节点来对一个类的默认校验组进行重定义(请参考 <xref linkend=\"section-default-group-class\"/>) ."

#. Tag: para
#: xmlconfiguration.xml:160
#, no-c-format
-msgid ""
-"Last but not least, the list of <classname>ConstraintValidator</classname>s "
-"associated to a given constraint can be altered via the <property>constraint-"
-"definition</property> node. The <property>annotation</property> attribute "
-"represents the constraint annotation being altered. The <property>validated-"
-"by</property> elements represent the (ordered) list of "
-"<classname>ConstraintValidator</classname> implementations associated to the "
-"constraint. If <property>include-existing-validator</property> is set to "
-"<constant>false</constant>, validators defined on the constraint annotation "
-"are ignored. If set to <constant>true</constant>, the list of "
-"ConstraintValidators described in XML are concatenated to the list of "
-"validators described on the annotation."
-msgstr ""
+msgid "Last but not least, the list of <classname>ConstraintValidator</classname>s associated to a given constraint can be altered via the <property>constraint-definition</property> node. The <property>annotation</property> attribute represents the constraint annotation being altered. The <property>validated-by</property> elements represent the (ordered) list of <classname>ConstraintValidator</classname> implementations associated to the constraint. If <property>include-existing-validator</property> is set to <constant>false</constant>, validators defined on the constraint annotation are ignored. If set to <constant>true</constant>, the list of ConstraintValidators described in XML are concatenated to the list of validators described on the annotation."
+msgstr "最后, 你还可以通过<property>constraint-definition</property>节点来对一个指定的约束条件上绑定的校验器(<classname>ConstraintValidator</classname>)进行修改. 此节点上的<property>annotation</property>对应要修改的约束条件, 而<property>validated-by</property>子节点中(按顺序)列出要关联到此约束条件上的校验器( <classname>ConstraintValidator</classname>的实现类), 而<property>include-existing-validator</property>属性如果是<constant>false</constant>的话,那么默认定义在此约束条件上的校验器将被忽略, 如果为<constant>true</constant>, 那么在xml中定义的校验器会被添加在约束条件上默认定义的校验器的后面."
+

_______________________________________________
hibernate-commits mailing list
hibernate-commits@(protected)
https://lists.jboss.org/mailman/listinfo/hibernate-commits
©2008 gg3721.com - Jax Systems, LLC, U.S.A.