# 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: 2011-01-12 15:42+0000\n"
"PO-Revision-Date: 2011-01-12 15:42+0000\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh-CN\n"

#. Tag: title
#: metadataapi.xml:24
#, no-c-format
msgid "Metadata API"
msgstr ""

#. Tag: para
#: metadataapi.xml:26
#, no-c-format
msgid ""
"The Bean Validation specification provides not only a validation engine, but "
"also a metadata repository for all defined constraints. The following "
"paragraphs are discussing this API. All the introduced classes can be found "
"in the <package>javax.validation.metadata</package> package."
msgstr ""

#. Tag: classname
#: metadataapi.xml:33
#, no-c-format
msgid "BeanDescriptor"
msgstr ""

#. Tag: para
#: metadataapi.xml:35
#, no-c-format
msgid ""
"The entry into the metadata API is via <code>Validator."
"getConstraintsForClass</code> which returns an instance of the <ulink url="
"\"http://docs.jboss.org/hibernate/stable/beanvalidation/api/javax/validation/"
"metadata/BeanDescriptor.html\"><classname>BeanDescriptor</classname></ulink> "
"interface. Using this bean descriptor you can determine whether the "
"specified class hosts any constraints at all via <code>beanDescriptor."
"isBeanConstrained</code>."
msgstr ""

#. Tag: para
#: metadataapi.xml:42
#, no-c-format
msgid ""
"If a constraint declaration hosted by the requested class is invalid, a "
"<classname>ValidationException</classname> is thrown."
msgstr ""

#. Tag: para
#: metadataapi.xml:47
#, no-c-format
msgid ""
"You can then call <code>beanDescriptor.getConstraintDescriptors</code> to "
"get a set of <classname>ConstraintDescriptor</classname>s representing all "
"class level constraints."
msgstr ""

#. Tag: para
#: metadataapi.xml:52
#, no-c-format
msgid ""
"If you are interested in property level constraints, you can call "
"<code>beanDescriptor.getConstraintsForProperty</code> or "
"<code>beanDescriptor.getConstrainedProperties</code> to get a single resp. "
"set of <classname>PropertyDescriptor</classname>s (see <xref linkend="
"\"section-property-descriptor\"/>)."
msgstr ""

#. Tag: classname
#: metadataapi.xml:60
#, no-c-format
msgid "PropertyDescriptor"
msgstr ""

#. Tag: para
#: metadataapi.xml:62
#, no-c-format
msgid ""
"The <ulink url=\"http://docs.jboss.org/hibernate/stable/beanvalidation/api/"
"javax/validation/metadata/PropertyDescriptor.html"
"\"><classname>PropertyDescriptor</classname></ulink> interface extends the "
"<classname>ElementDescriptor</classname> interface and represents "
"constraints on properties of a class. The constraint can be declared on the "
"attribute itself or on the getter of the attribute - provided Java Bean "
"naming conventions are respected. A <classname>PropertyDescriptor</"
"classname> adds <code>isCascaded</code> (returning <constant>true</constant> "
"if the property is marked with <classname>@Valid</classname>) and "
"<code>getPropertyName</code> to the <classname>ElementDescriptor</classname> "
"functionality."
msgstr ""

#. Tag: classname
#: metadataapi.xml:75
#, no-c-format
msgid "ElementDescriptor"
msgstr ""

#. Tag: para
#: metadataapi.xml:77
#, no-c-format
msgid ""
"The <ulink url=\"http://docs.jboss.org/hibernate/stable/beanvalidation/api/"
"javax/validation/metadata/ElementDescriptor.html"
"\"><classname>ElementDiscriptor</classname></ulink> interface is the common "
"base class for <classname>BeanDescriptor</classname> and "
"<classname>PropertyDescriptor</classname>. Next to the <code>hasConstraints "
"</code>and <code>getConstraintDescriptors</code> methods it also offers "
"access to the <classname>ConstraintFinder</classname> API which allows you "
"to query the metadata API in a more fine grained way. For example you can "
"restrict your search to constraints described on fields or on getters or a "
"given set of groups. Given an <classname>ElementDescriptor</classname> "
"instance you just call <code>findConstraints</code> to retrieve a "
"<classname>ConstraintFinder</classname> instance."
msgstr ""

#. Tag: title
#: metadataapi.xml:92
#, no-c-format
msgid "Usage of ConstraintFinder"
msgstr ""

#. Tag: programlisting
#: metadataapi.xml:94
#, no-c-format
msgid ""
"Validator validator = Validation.buildDefaultValidatorFactory().getValidator"
"();\n"
"BeanDescriptor beanDescriptor = validator.getConstraintsForClass(Person."
"class);\n"
"PropertyDescriptor propertyDescriptor = beanDescriptor."
"getConstraintsForProperty(\"name\");\n"
"Set&lt;ConstraintDescriptor&lt;?&gt;&gt; constraints = propertyDescriptor."
"findConstraints()\n"
"                                           .declaredOn(ElementType.METHOD)\n"
"                                           .unorderedAndMatchingGroups"
"(Default.class)\n"
"                                           .lookingAt(Scope.LOCAL_ELEMENT)\n"
"                                           .getConstraintDescriptors();"
msgstr ""

#. Tag: para
#: metadataapi.xml:97
#, no-c-format
msgid ""
"shows an example on how to use the <classname>ConstraintFinder</classname> "
"API. Interesting are especially the restrictions "
"<code>unorderedAndMatchingGroups</code> and <code>lookingAt(<ulink url="
"\"http://docs.jboss.org/hibernate/stable/beanvalidation/api/javax/validation/"
"metadata/Scope.html\">Scope.LOCAL_ELEMENT</ulink>)</code>. The former allows "
"to only return <classname>ConstraintDescriptors</classname> matching a "
"specified set of groups wheras the latter allows to distinguish between "
"constraint directly specified on the element (<constant>Scope.LOCAL_ELEMENT</"
"constant>) or constraints belonging to the element but hosted anywhere in "
"the class hierarchy (<constant>Scope.HIERARCHY</constant>)."
msgstr ""

#. Tag: para
#: metadataapi.xml:108
#, no-c-format
msgid ""
"Order is not respected by unorderedAndMatchingGroups, but group inheritance "
"and inheritance via sequence are."
msgstr ""

#. Tag: classname
#: metadataapi.xml:114
#, no-c-format
msgid "ConstraintDescriptor"
msgstr ""

#. Tag: para
#: metadataapi.xml:116
#, no-c-format
msgid ""
"Last but not least, the <ulink url=\"http://docs.jboss.org/hibernate/stable/"
"beanvalidation/api/javax/validation/metadata/ConstraintDescriptor.html"
"\"><classname>ConstraintDescriptor</classname></ulink> interface describes a "
"single constraint together with its composing constraints. Via an instance "
"of this interface you get access to the constraint annotation and its "
"parameters, as well as the groups the constraint is supposed to be applied "
"on. It also also you to access the pass-through constraint payload (see "
"<xref linkend=\"example-defining-custom-constraint\"/>)."
msgstr ""
