-
Notifications
You must be signed in to change notification settings - Fork 566
/
customoptions.pot
243 lines (214 loc) · 9.82 KB
/
customoptions.pot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# SOME DESCRIPTIVE TITLE.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2011-02-11 15:21+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <kde-i18n-doc@kde.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: application/x-xml2pot; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. Tag: title
#: customoptions.xml:24
#, no-c-format
msgid "Hibernate Validator specific configuration"
msgstr ""
#. Tag: para
#: customoptions.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
#: customoptions.xml:31
#, no-c-format
msgid "The Bean Validation specification allows implementators to add provider specific options. The easiest way to do this is via <methodname>Configuration.addProperty(String name, String value)</methodname> which allows to pass any arbitrary property. If you want to expose the option programmatically (in a type-safe manner) there are three other options depending on where you want to make the option available."
msgstr ""
#. Tag: para
#: customoptions.xml:39
#, no-c-format
msgid "You can add the option onto a custom <classname>Configuration</classname> instance. This custom configuration can be explicitly requested during the bootstrapping process using <methodname>Validation.byProvider(Class<U> providerType)</methodname>. This is the approach taken for exposing the programmatic constraint configuration API (see <xref linkend=\"programmaticapi\"/> ) as well as the abiltiy to configure a custom ResourceBundleLocator (see <xref linkend=\"section-resource-bundle-locator\"/>)."
msgstr ""
#. Tag: para
#: customoptions.xml:48
#, no-c-format
msgid "You cam also add the option accessible on you <classname>ValidatorFactory</classname> implementation and then access it via <methodname>ValidatorFactory.unwrap(Class<T> type)</methodname> (see <xref linkend=\"example-fail-fast-factory\"/>)."
msgstr ""
#. Tag: para
#: customoptions.xml:53
#, no-c-format
msgid "Last but not least, you can also add the option to your <classname>Validator</classname> implementation and unwrap the <classname>Validator</classname> instance itself using <methodname>Validator.unwrap(Class<T> type)</methodname>. This is how the method level validation API is exposed in Hibernate Validator (see ?)."
msgstr ""
#. Tag: para
#: customoptions.xml:60
#, no-c-format
msgid "In the following sections weare having a closer look at some of the Hibernate Validator specific features."
msgstr ""
#. Tag: title
#: customoptions.xml:64
#, no-c-format
msgid "Fail fast mode"
msgstr ""
#. Tag: para
#: customoptions.xml:66
#, no-c-format
msgid "Hibernate Validator allows to return from the current validation as soon as the first constraint violation occurs. This is called the fail fast mode and can be useful for validation of large object graphs where you are 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:76
#, no-c-format
msgid "Enabling <option>failFast</option> via a property"
msgstr ""
#. Tag: programlisting
#: customoptions.xml:78
#, 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:82
#, no-c-format
msgid "Enabling <option>failFast</option> at the <classname>Configuration</classname> level"
msgstr ""
#. Tag: programlisting
#: customoptions.xml:85
#, no-c-format
msgid ""
"HibernateValidatorConfiguration configuration = Validation.byProvider( HibernateValidator.class ).configure();\n"
"ValidatorFactory factory = configuration.failFast().buildValidatorFactory();\n"
"Validator validator = factory.getValidator();\n"
"\n"
"// do some actual fail fast validation\n"
"..."
msgstr ""
#. Tag: title
#: customoptions.xml:89
#, no-c-format
msgid "Enabling <option>failFast</option> at the <classname>ValidatorFactory</classname> level"
msgstr ""
#. Tag: programlisting
#: customoptions.xml:92
#, 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()\n"
" .getValidator();\n"
"\n"
"// do fail fast validation\n"
"..."
msgstr ""
#. Tag: title
#: customoptions.xml:97 customoptions.xml:115
#, no-c-format
msgid "Programmatic constraint definition"
msgstr ""
#. Tag: para
#: customoptions.xml:99
#, 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 ""
#. Tag: para
#: customoptions.xml:105
#, 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 ""
#. Tag: programlisting
#: customoptions.xml:117
#, 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 ""
#. Tag: para
#: customoptions.xml:120
#, 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 ""
#. Tag: title
#: customoptions.xml:133
#, no-c-format
msgid "Programmatic constraint definition using <classname>GenericConstraintDef</classname>"
msgstr ""
#. Tag: programlisting
#: customoptions.xml:136
#, 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 ""
#. Tag: para
#: customoptions.xml:139
#, 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 ""
#. Tag: title
#: customoptions.xml:143
#, no-c-format
msgid "Cascading constraints and group redefinition"
msgstr ""
#. Tag: programlisting
#: customoptions.xml:145
#, 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 ""
#. Tag: para
#: customoptions.xml:148
#, 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 ""
#. Tag: title
#: customoptions.xml:155
#, no-c-format
msgid "Creating a Hibernate Validator specific configuration"
msgstr ""
#. Tag: programlisting
#: customoptions.xml:157
#, 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 ""