You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2012/11/25 07:15:28 UTC
git commit: WICKET-4883 out of the box bean validation integration
(jsr 303)
Updated Branches:
refs/heads/master 2d47bf340 -> 580a8dd9e
WICKET-4883 out of the box bean validation integration (jsr 303)
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/580a8dd9
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/580a8dd9
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/580a8dd9
Branch: refs/heads/master
Commit: 580a8dd9eb212a645bdfe5ee456fae77cc87fbdb
Parents: 2d47bf3
Author: Igor Vaynberg <ig...@gmail.com>
Authored: Sat Nov 24 22:15:15 2012 -0800
Committer: Igor Vaynberg <ig...@gmail.com>
Committed: Sat Nov 24 22:15:15 2012 -0800
----------------------------------------------------------------------
pom.xml | 11 +-
wicket-examples/pom.xml | 11 +
.../bean/validation/BeanValidationApplication.java | 36 ++
.../bean/validation/BeanValidationPage.html | 48 +++
.../bean/validation/BeanValidationPage.java | 49 +++
.../bean/validation/BeanValidationPage.properties | 14 +
.../wicket/examples/bean/validation/Person.java | 86 +++++
.../apache/wicket/examples/homepage/HomePage.html | 1 +
wicket-examples/src/main/webapp/WEB-INF/web.xml | 18 +-
.../org/apache/wicket/examples/StartExamples.java | 3 -
wicket-experimental/pom.xml | 1 +
.../.settings/org.eclipse.jdt.core.prefs | 284 +++++++++++++++
.../.settings/org.eclipse.jdt.ui.prefs | 3 +
wicket-experimental/wicket-bean-validation/pom.xml | 36 ++
.../validation/BeanValidationConfiguration.java | 147 ++++++++
.../bean/validation/BeanValidationContext.java | 42 +++
.../wicket/bean/validation/ConstraintIterator.java | 89 +++++
.../bean/validation/DefaultPropertyResolver.java | 50 +++
.../bean/validation/DefaultValidatorProvider.java | 41 ++
.../validation/DefaultViolationTranslator.java | 60 +++
.../apache/wicket/bean/validation/GroupsModel.java | 60 +++
.../wicket/bean/validation/IPropertyResolver.java | 20 +
.../wicket/bean/validation/ITagModifier.java | 31 ++
.../bean/validation/IViolationTranslator.java | 24 ++
.../apache/wicket/bean/validation/Property.java | 41 ++
.../wicket/bean/validation/PropertyValidator.java | 219 +++++++++++
.../bean/validation/PropertyValidator.properties | 24 ++
.../bean/validation/SessionLocaleInterpolator.java | 54 +++
.../wicket/bean/validation/SizeTagModifier.java | 26 ++
.../org/apache/wicket/bean/validation/package.html | 52 +++
30 files changed, 1573 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index d13f66a..32c94d9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,8 +14,7 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache</groupId>
@@ -56,7 +55,7 @@
<module>wicket-experimental</module>
<module>archetypes/quickstart</module>
<module>testing/wicket-common-tests</module>
- </modules>
+ </modules>
<profiles>
<profile>
<id>release</id>
@@ -217,6 +216,12 @@
<version>6.4.0-SNAPSHOT</version>
<type>jar</type>
</dependency>
+ <dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-bean-validation</artifactId>
+ <version>0.5-SNAPSHOT</version>
+ <type>jar</type>
+ </dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-devutils</artifactId>
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-examples/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-examples/pom.xml b/wicket-examples/pom.xml
index b12e028..e61154b 100644
--- a/wicket-examples/pom.xml
+++ b/wicket-examples/pom.xml
@@ -48,6 +48,17 @@
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-guice</artifactId>
</dependency>
+ <!-- bean validation -->
+ <dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-bean-validation</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>4.3.0.Final</version>
+ </dependency>
+ <!-- / bean validation -->
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-jmx</artifactId>
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationApplication.java
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationApplication.java b/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationApplication.java
new file mode 100644
index 0000000..a2fd84c
--- /dev/null
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationApplication.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.examples.bean.validation;
+
+import org.apache.wicket.Page;
+import org.apache.wicket.bean.validation.BeanValidationConfiguration;
+import org.apache.wicket.examples.WicketExampleApplication;
+
+public class BeanValidationApplication extends WicketExampleApplication
+{
+ @Override
+ public Class<? extends Page> getHomePage()
+ {
+ return BeanValidationPage.class;
+ }
+
+ @Override
+ protected void init()
+ {
+ new BeanValidationConfiguration().configure(this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.html
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.html b/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.html
new file mode 100644
index 0000000..1a7d837
--- /dev/null
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.html
@@ -0,0 +1,48 @@
+<html xmlns:wicket="http://wicket.apache.org">
+<head>
+<title>Wicket Examples - Bean Validation</title>
+<link rel="stylesheet" type="text/css" href="style.css" />
+<style>
+ .note { font-size:.8em; }
+ .required {font-weight: bold;}
+</style>
+</head>
+<body>
+ <span wicket:id="mainNavigation" />
+
+ <div wicket:id="feedback"></div>
+
+ <form wicket:id="form">
+ <table cellspacing="0" cellpadding="4">
+ <tr>
+ <td><label wicket:for="name"><wicket:label>Name</wicket:label></label></td>
+ <td><input wicket:id="name" type="text" size="30"/></td>
+ <td><pre class="note">@NotNull @Size(min = 2, max = 30)</pre></td>
+ </tr>
+ <tr>
+ <td><label wicket:for="email"><wicket:label>Email</wicket:label></label></td>
+ <td><input wicket:id="email" type="text" size="30"/></td>
+ <td><pre class="note">@NotNull @Email</pre></td>
+ </tr>
+ <tr>
+ <td><label wicket:for="phone"><wicket:label>Phone</wicket:label></label></td>
+ <td><input wicket:id="phone" type="text" size="20"/></td>
+ <td><pre class="note">@Pattern(regexp = "[0-9]{3}-[0-9]{4}")</pre></td>
+ </tr>
+ <tr>
+ <td><label wicket:for="birthdate"><wicket:label>Birthdate</wicket:label></label></td>
+ <td><input wicket:id="birthdate" type="text" size="10"/></td>
+ <td><pre class="note">m/d/yyyy field with @Past</pre></td>
+ </tr>
+ <tr>
+ <td> </td>
+ <td>
+ <input type="submit" value="Submit"/>
+ </td>
+ <td><span class="note">press to submit the form and run the validation</span></td>
+ </tr>
+ </table>
+ </form>
+
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.java
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.java b/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.java
new file mode 100644
index 0000000..8560738
--- /dev/null
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.examples.bean.validation;
+
+import java.util.Date;
+
+import org.apache.wicket.bean.validation.PropertyValidator;
+import org.apache.wicket.datetime.StyleDateConverter;
+import org.apache.wicket.datetime.markup.html.form.DateTextField;
+import org.apache.wicket.examples.WicketExamplePage;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.markup.html.panel.FeedbackPanel;
+import org.apache.wicket.model.PropertyModel;
+
+public class BeanValidationPage extends WicketExamplePage
+{
+
+ Person person = new Person();
+
+ public BeanValidationPage()
+ {
+ add(new FeedbackPanel("feedback"));
+
+ Form<?> form = new Form<Void>("form");
+ add(form);
+
+ form.add(new TextField<String>("name", new PropertyModel<String>(this, "person.name")).add(new PropertyValidator<String>()));
+ form.add(new TextField<String>("phone", new PropertyModel<String>(this, "person.phone")).add(new PropertyValidator<String>()));
+ form.add(new TextField<String>("email", new PropertyModel<String>(this, "person.email")).add(new PropertyValidator<String>()));
+ form.add(new DateTextField("birthdate", new PropertyModel<Date>(this, "person.birthdate"),
+ new StyleDateConverter("S-", true)).add(new PropertyValidator<String>()));
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.properties
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.properties b/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.properties
new file mode 100644
index 0000000..c89b963
--- /dev/null
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.properties
@@ -0,0 +1,14 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/Person.java
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/Person.java b/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/Person.java
new file mode 100644
index 0000000..286627a
--- /dev/null
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/Person.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.examples.bean.validation;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Past;
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
+
+import org.hibernate.validator.constraints.Email;
+
+public class Person implements Serializable
+{
+ @NotNull
+ @Size(min = 2, max = 30)
+ private String name;
+
+ @NotNull
+ @Email
+ private String email;
+
+ @Pattern(regexp = "[0-9]{3}-[0-9]{4}")
+ private String phone;
+
+ @Past
+ private Date birthdate;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getEmail()
+ {
+ return email;
+ }
+
+ public void setEmail(String email)
+ {
+ this.email = email;
+ }
+
+ public String getPhone()
+ {
+ return phone;
+ }
+
+ public void setPhone(String phone)
+ {
+ this.phone = phone;
+ }
+
+ public Date getBirthdate()
+ {
+ return birthdate;
+ }
+
+ public void setBirthdate(Date birthdate)
+ {
+ this.birthdate = birthdate;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-examples/src/main/resources/org/apache/wicket/examples/homepage/HomePage.html
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/resources/org/apache/wicket/examples/homepage/HomePage.html b/wicket-examples/src/main/resources/org/apache/wicket/examples/homepage/HomePage.html
index 44934d5..e8d396d 100644
--- a/wicket-examples/src/main/resources/org/apache/wicket/examples/homepage/HomePage.html
+++ b/wicket-examples/src/main/resources/org/apache/wicket/examples/homepage/HomePage.html
@@ -64,6 +64,7 @@
<tr><td align="right"><a href="resourceaggregation">Resource decoration</a></td><td> - Shows aggregation of css and js resources</td></tr>
<tr><td align="right"><a href="atmosphere">Atmosphere</a></td><td> - Atmosphere Framework integration</td></tr>
<tr><td align="right"><a href="cdi">CDI</a></td><td> - Context Dependency and Injection integration</td></tr>
+ <tr><td align="right"><a href="bean-validation">Bean Validation</a></td><td> - Bean Validation integration</td></tr>
</tbody>
</table>
</div>
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-examples/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/webapp/WEB-INF/web.xml b/wicket-examples/src/main/webapp/WEB-INF/web.xml
index 9f5e5e2..79db694 100644
--- a/wicket-examples/src/main/webapp/WEB-INF/web.xml
+++ b/wicket-examples/src/main/webapp/WEB-INF/web.xml
@@ -70,7 +70,7 @@
<param-value>org.apache.wicket.examples.ajax.prototype.PrototypeApplication</param-value>
</init-param>
</filter>
-
+
<filter>
<filter-name>AjaxApplication</filter-name>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
@@ -769,6 +769,20 @@
<filter-name>CdiApplication</filter-name>
<url-pattern>/cdi/*</url-pattern>
</filter-mapping>
+
+ <!-- CDI EXAMPLE APPLICATION -->
+ <filter>
+ <filter-name>BeanValidation</filter-name>
+ <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
+ <init-param>
+ <param-name>applicationClassName</param-name>
+ <param-value>org.apache.wicket.examples.bean.validation.BeanValidationApplication</param-value>
+ </init-param>
+ </filter>
+ <filter-mapping>
+ <filter-name>BeanValidation</filter-name>
+ <url-pattern>/bean-validation/*</url-pattern>
+ </filter-mapping>
<listener>
<!-- initialize Weld in servlet environment -->
@@ -819,9 +833,9 @@
<param-name>org.atmosphere.useWebSocket</param-name>
<param-value>true</param-value>
</init-param>
+ <param-value>true</param-value>
<init-param>
<param-name>org.atmosphere.useNative</param-name>
- <param-value>true</param-value>
</init-param>
<init-param>
<param-name>org.atmosphere.cpr.CometSupport.maxInactiveActivity</param-name>
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-examples/src/test/java/org/apache/wicket/examples/StartExamples.java
----------------------------------------------------------------------
diff --git a/wicket-examples/src/test/java/org/apache/wicket/examples/StartExamples.java b/wicket-examples/src/test/java/org/apache/wicket/examples/StartExamples.java
index c2b8eab..14bc444 100644
--- a/wicket-examples/src/test/java/org/apache/wicket/examples/StartExamples.java
+++ b/wicket-examples/src/test/java/org/apache/wicket/examples/StartExamples.java
@@ -59,9 +59,6 @@ public class StartExamples
bb.setContextPath("/");
bb.setWar("src/main/webapp");
- // uncomment next line if you want to test with JSESSIONID encoded in the urls
-// ((AbstractSessionManager) bb.getSessionHandler().getSessionManager()).setUsingCookies(false);
-
server.setHandler(bb);
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-experimental/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/pom.xml b/wicket-experimental/pom.xml
index ddf79f8..3f3c648 100644
--- a/wicket-experimental/pom.xml
+++ b/wicket-experimental/pom.xml
@@ -32,6 +32,7 @@
<module>wicket-native-websocket</module>
<module>wicket-bootstrap</module>
<module>wicket-examples-parent</module>
+ <module>wicket-bean-validation</module>
</modules>
<dependencyManagement>
<dependencies>
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-experimental/wicket-bean-validation/.settings/org.eclipse.jdt.core.prefs
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-bean-validation/.settings/org.eclipse.jdt.core.prefs b/wicket-experimental/wicket-bean-validation/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..0d1744f
--- /dev/null
+++ b/wicket-experimental/wicket-bean-validation/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,284 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=80
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=64
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=0
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=0
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=100
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=1
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=100
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=2
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=false
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-experimental/wicket-bean-validation/.settings/org.eclipse.jdt.ui.prefs
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-bean-validation/.settings/org.eclipse.jdt.ui.prefs b/wicket-experimental/wicket-bean-validation/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..b7196ce
--- /dev/null
+++ b/wicket-experimental/wicket-bean-validation/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+formatter_profile=_Wicket
+formatter_settings_version=12
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-experimental/wicket-bean-validation/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-bean-validation/pom.xml b/wicket-experimental/wicket-bean-validation/pom.xml
new file mode 100644
index 0000000..fc84b1b
--- /dev/null
+++ b/wicket-experimental/wicket-bean-validation/pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-experimental</artifactId>
+ <version>6.4.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-bean-validation</artifactId>
+ <version>0.5-SNAPSHOT</version>
+ <name>wicket-bean-validation</name>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.10</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ <version>1.0.0.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.wicket</groupId>
+ <artifactId>wicket-core</artifactId>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationConfiguration.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationConfiguration.java b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationConfiguration.java
new file mode 100644
index 0000000..8de367c
--- /dev/null
+++ b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationConfiguration.java
@@ -0,0 +1,147 @@
+package org.apache.wicket.bean.validation;
+
+import java.lang.annotation.Annotation;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import javax.validation.Validator;
+import javax.validation.constraints.Size;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.MetaDataKey;
+import org.apache.wicket.markup.html.form.FormComponent;
+import org.apache.wicket.util.IProvider;
+import org.apache.wicket.util.lang.Args;
+
+/**
+ * Configures bean validation and integrates it with Wicket
+ *
+ * @author igor
+ *
+ */
+public class BeanValidationConfiguration implements BeanValidationContext
+{
+ private static final MetaDataKey<BeanValidationConfiguration> KEY = new MetaDataKey<BeanValidationConfiguration>()
+ {
+ };
+
+ private IProvider<Validator> validatorProvider = new DefaultValidatorProvider();
+
+ private IViolationTranslator violationTranslator = new DefaultViolationTranslator();
+
+ private List<IPropertyResolver> propertyResolvers = new CopyOnWriteArrayList<IPropertyResolver>();
+
+ private Map<Class<?>, ITagModifier<? extends Annotation>> tagModifiers = new ConcurrentHashMap<Class<?>, ITagModifier<? extends Annotation>>();
+
+ public BeanValidationConfiguration()
+ {
+ add(new DefaultPropertyResolver());
+ register(Size.class, new SizeTagModifier());
+ }
+
+ /**
+ * Registeres a tag modifier for a specific constraint annotation
+ *
+ * @param annotationType
+ * constraint annotation such as {@link Size}
+ * @param modifier
+ * tag modifier to use
+ * @return {@code this}
+ */
+ public <T extends Annotation> BeanValidationConfiguration register(Class<T> annotationType,
+ ITagModifier<T> modifier)
+ {
+ Args.notNull(annotationType, "annotationType");
+ Args.notNull(modifier, "modifier");
+
+ tagModifiers.put(annotationType, modifier);
+
+ return this;
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public <T extends Annotation> ITagModifier<T> getTagModifier(Class<T> annotationType)
+ {
+ Args.notNull(annotationType, "annotationType");
+
+ return (ITagModifier<T>)tagModifiers.get(annotationType);
+ }
+
+ /**
+ * Adds a property resolver to the configuration. Property resolvers registered last are the
+ * first to be allowed to resolve the property.
+ *
+ * @param resolver
+ * @return {@code this}
+ */
+ public BeanValidationConfiguration add(IPropertyResolver resolver)
+ {
+ Args.notNull(resolver, "resolver");
+
+ // put newly added resolvers in the beginning so its possible to override previously added
+ // resolvers with newer ones
+ propertyResolvers.add(0, resolver);
+
+ return this;
+ }
+
+ /**
+ * @return validator
+ */
+ @Override
+ public Validator getValidator()
+ {
+ return validatorProvider.get();
+ }
+
+ /**
+ * Binds this configuration to the application instance
+ *
+ * @param application
+ */
+ public void configure(Application application)
+ {
+ application.setMetaData(KEY, this);
+ }
+
+ /** @return registered violation translator */
+ @Override
+ public IViolationTranslator getViolationTranslator()
+ {
+ return violationTranslator;
+ }
+
+ /**
+ * Retrieves the validation context (read only version of the configuration). This is how
+ * components retrieve the configuration.
+ *
+ * @return validation context
+ */
+ public static BeanValidationContext get()
+ {
+ BeanValidationConfiguration config = Application.get().getMetaData(KEY);
+ if (config == null)
+ {
+ throw new IllegalStateException(
+ "Application instance has not yet been configured for bean validation. See BeanValidationConfiguration#configure(Application)");
+ }
+ return config;
+ }
+
+ @Override
+ public Property resolveProperty(FormComponent<?> component)
+ {
+ for (IPropertyResolver resolver : propertyResolvers)
+ {
+ Property property = resolver.resolveProperty(component);
+ if (property != null)
+ {
+ return property;
+ }
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationContext.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationContext.java b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationContext.java
new file mode 100644
index 0000000..702805d
--- /dev/null
+++ b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationContext.java
@@ -0,0 +1,42 @@
+package org.apache.wicket.bean.validation;
+
+import java.lang.annotation.Annotation;
+
+import javax.validation.Validator;
+
+import org.apache.wicket.markup.html.form.FormComponent;
+
+/**
+ * A read-only view of {@link BeanValidationConfiguration} that can be retrieved by components to
+ * access the validator and other helpers.
+ *
+ * @see BeanValidationConfiguration#get()
+ *
+ * @author igor
+ *
+ */
+public interface BeanValidationContext extends IPropertyResolver
+{
+
+ /**
+ * Gets the tag modifier for the specified annotation type
+ *
+ * @param annotationType
+ * @return tag modifier or {@code null} if none
+ */
+ public abstract <T extends Annotation> ITagModifier<T> getTagModifier(Class<T> annotationType);
+
+ /**
+ * @return the validator
+ */
+ public abstract Validator getValidator();
+
+ /**
+ * @return the violation translator
+ */
+ public abstract IViolationTranslator getViolationTranslator();
+
+ @Override
+ public abstract Property resolveProperty(FormComponent<?> component);
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/ConstraintIterator.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/ConstraintIterator.java b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/ConstraintIterator.java
new file mode 100644
index 0000000..4284f1c
--- /dev/null
+++ b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/ConstraintIterator.java
@@ -0,0 +1,89 @@
+package org.apache.wicket.bean.validation;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.validation.Validator;
+import javax.validation.metadata.BeanDescriptor;
+import javax.validation.metadata.ConstraintDescriptor;
+import javax.validation.metadata.PropertyDescriptor;
+
+/**
+ * Iterates constraint descriptors for the specified property.
+ *
+ * @author igor
+ *
+ */
+class ConstraintIterator implements Iterator<ConstraintDescriptor<?>>
+{
+ private ConstraintDescriptor<?> next;
+
+ private List<Iterator<ConstraintDescriptor<?>>> stack = new ArrayList<Iterator<ConstraintDescriptor<?>>>();
+
+ public ConstraintIterator(Validator validator, Property property, Class<?>... groups)
+ {
+ BeanDescriptor beanDesc = validator.getConstraintsForClass(property.getOwner());
+ if (beanDesc != null)
+ {
+ PropertyDescriptor propDesc = beanDesc.getConstraintsForProperty(property.getName());
+ if (propDesc != null)
+ {
+ // TODO use hasConstraintDesc to optimize...?
+ Set<ConstraintDescriptor<?>> constraints = propDesc.findConstraints()
+ .unorderedAndMatchingGroups(groups)
+ .getConstraintDescriptors();
+ if (constraints != null)
+ {
+ stack.add(constraints.iterator());
+ findNext();
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean hasNext()
+ {
+ return next != null;
+ }
+
+ private void findNext()
+ {
+ next = null;
+ while (!stack.isEmpty())
+ {
+ Iterator<ConstraintDescriptor<?>> top = stack.get(stack.size() - 1);
+ if (top.hasNext())
+ {
+ next = top.next();
+ Set<ConstraintDescriptor<?>> composing = next.getComposingConstraints();
+ if (!composing.isEmpty())
+ {
+ stack.add(composing.iterator());
+ }
+ break;
+ }
+ else
+ {
+ stack.remove(stack.size() - 1);
+ }
+ }
+ }
+
+ @Override
+ public ConstraintDescriptor<?> next()
+ {
+ ConstraintDescriptor<?> ret = next;
+ findNext();
+ return ret;
+ }
+
+ @Override
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/DefaultPropertyResolver.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/DefaultPropertyResolver.java b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/DefaultPropertyResolver.java
new file mode 100644
index 0000000..64caf18
--- /dev/null
+++ b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/DefaultPropertyResolver.java
@@ -0,0 +1,50 @@
+package org.apache.wicket.bean.validation;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.apache.wicket.markup.html.form.FormComponent;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.IPropertyReflectionAwareModel;
+import org.apache.wicket.model.PropertyModel;
+
+/**
+ * Default property resolver. This resolver supports common Wicket models like the
+ * {@link PropertyModel}, and other implementations of {@link IPropertyReflectionAwareModel}
+ *
+ * @author igor
+ *
+ */
+public class DefaultPropertyResolver implements IPropertyResolver
+{
+
+ @Override
+ public Property resolveProperty(FormComponent<?> component)
+ {
+ IModel<?> model = component.getModel();
+
+ if (!(model instanceof IPropertyReflectionAwareModel))
+ {
+ return null;
+ }
+
+ IPropertyReflectionAwareModel<?> delegate = (IPropertyReflectionAwareModel<?>)model;
+
+ Field field = delegate.getPropertyField();
+ if (field != null)
+ {
+ return new Property(field.getDeclaringClass(), field.getName());
+ }
+
+ Method getter = delegate.getPropertyGetter();
+ if (getter != null)
+ {
+ String name = getter.getName().substring(3, 1).toLowerCase() +
+ getter.getName().substring(4);
+ return new Property(getter.getDeclaringClass(), name);
+ }
+
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/DefaultValidatorProvider.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/DefaultValidatorProvider.java b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/DefaultValidatorProvider.java
new file mode 100644
index 0000000..0385205
--- /dev/null
+++ b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/DefaultValidatorProvider.java
@@ -0,0 +1,41 @@
+package org.apache.wicket.bean.validation;
+
+import javax.validation.Configuration;
+import javax.validation.MessageInterpolator;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+
+import org.apache.wicket.util.IProvider;
+
+/**
+ * This is the default validator provider. It creates a validator instance with the default message
+ * interpolator wrapped inside a {@link SessionLocaleInterpolator} so it is aware of Wicket's
+ * locale. Only one instance of the {@link Validator} is created.
+ *
+ * @author igor
+ *
+ */
+public class DefaultValidatorProvider implements IProvider<Validator>
+{
+
+ private Validator validator;
+
+ @Override
+ public Validator get()
+ {
+ if (validator == null)
+ {
+ Configuration<?> config = Validation.byDefaultProvider().configure();
+
+ MessageInterpolator interpolator = config.getDefaultMessageInterpolator();
+ interpolator = new SessionLocaleInterpolator(interpolator);
+
+ ValidatorFactory factory = config.messageInterpolator(interpolator)
+ .buildValidatorFactory();
+
+ validator = factory.getValidator();
+ }
+ return validator;
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/DefaultViolationTranslator.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/DefaultViolationTranslator.java b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/DefaultViolationTranslator.java
new file mode 100644
index 0000000..feec4f3
--- /dev/null
+++ b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/DefaultViolationTranslator.java
@@ -0,0 +1,60 @@
+package org.apache.wicket.bean.validation;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.metadata.ConstraintDescriptor;
+
+import org.apache.wicket.util.string.Strings;
+import org.apache.wicket.validation.ValidationError;
+
+/**
+ * A default implementation of {@link IViolationTranslator}. The validation error is created with
+ * the constraint violation's default error message. Further, the violation is checked for a message
+ * key and if is found it is also added as a message key to the validation error. The keys are only
+ * used if they are in the bean validation's default format of '{key}'.
+ *
+ * @author igor
+ */
+public class DefaultViolationTranslator implements IViolationTranslator
+{
+ @Override
+ public <T> ValidationError convert(ConstraintViolation<T> violation)
+ {
+ ConstraintDescriptor<?> desc = violation.getConstraintDescriptor();
+
+ ValidationError error = new ValidationError();
+ error.setMessage(violation.getMessage());
+
+ String messageKey = getMessageKey(desc);
+ if (messageKey != null)
+ {
+ if (violation.getInvalidValue() != null)
+ {
+ error.addKey(messageKey + "." +
+ violation.getInvalidValue().getClass().getSimpleName());
+ }
+ error.addKey(messageKey);
+ }
+
+ for (String key : desc.getAttributes().keySet())
+ {
+ error.setVariable(key, desc.getAttributes().get(key));
+ }
+ return error;
+ }
+
+ private String getMessageKey(ConstraintDescriptor<?> desc)
+ {
+ final Object val = desc.getAttributes().get("message");
+ if (val != null)
+ {
+ String str = val.toString();
+ if (!Strings.isEmpty(str) && str.startsWith("{") && str.endsWith("}"))
+ {
+ return str.substring(1, str.length() - 1);
+ }
+ }
+ return null;
+ }
+
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/GroupsModel.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/GroupsModel.java b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/GroupsModel.java
new file mode 100644
index 0000000..40d3a9d
--- /dev/null
+++ b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/GroupsModel.java
@@ -0,0 +1,60 @@
+package org.apache.wicket.bean.validation;
+
+import java.util.ArrayList;
+
+import org.apache.wicket.model.LoadableDetachableModel;
+import org.apache.wicket.util.reference.ClassReference;
+
+/**
+ * A model that can hold on to an array of classes. Useful for keeping a definition of validation
+ * groups to be used to restrict validation.
+ *
+ * @author igor
+ */
+public class GroupsModel extends LoadableDetachableModel<Class<?>[]>
+{
+ private static Class<?>[] EMPTY = new Class<?>[0];
+
+ private ArrayList<ClassReference<?>> groups = null;
+
+ /**
+ * Constructor
+ *
+ * @param groups
+ * an array of groups or {@code null} for none
+ */
+ public GroupsModel(Class<?>... groups)
+ {
+ if (groups == null || groups.length == 0)
+ {
+ this.groups = null;
+ }
+ else
+ {
+ this.groups = new ArrayList<ClassReference<?>>();
+ for (Class<?> group : groups)
+ {
+ this.groups.add(ClassReference.of(group));
+ }
+ this.groups.trimToSize();
+ }
+ }
+
+ @Override
+ protected Class<?>[] load()
+ {
+ if (groups == null)
+ {
+ return EMPTY;
+ }
+
+ Class<?>[] classes = new Class[groups.size()];
+ for (int i = 0; i < groups.size(); i++)
+ {
+ classes[i] = groups.get(i).get();
+ }
+
+ return classes;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/IPropertyResolver.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/IPropertyResolver.java b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/IPropertyResolver.java
new file mode 100644
index 0000000..9e54902
--- /dev/null
+++ b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/IPropertyResolver.java
@@ -0,0 +1,20 @@
+package org.apache.wicket.bean.validation;
+
+import org.apache.wicket.markup.html.form.FormComponent;
+import org.apache.wicket.model.IPropertyReflectionAwareModel;
+
+/**
+ * Resolves the property to be validated for the given form component. Implementations, incuding the
+ * default one, usually check the form component's model for some subclass that can provide the
+ * necessary meta information to resolve the property.
+ *
+ * @see DefaultPropertyResolver
+ * @see IPropertyReflectionAwareModel
+ *
+ * @author igor
+ *
+ */
+public interface IPropertyResolver
+{
+ Property resolveProperty(FormComponent<?> component);
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/ITagModifier.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/ITagModifier.java b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/ITagModifier.java
new file mode 100644
index 0000000..6c2dacf
--- /dev/null
+++ b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/ITagModifier.java
@@ -0,0 +1,31 @@
+package org.apache.wicket.bean.validation;
+
+import java.lang.annotation.Annotation;
+
+import javax.validation.constraints.Size;
+
+import org.apache.wicket.markup.ComponentTag;
+import org.apache.wicket.markup.html.form.FormComponent;
+
+/**
+ * An object that can modify a component's markup tag during render based on values of a constraint
+ * annotation. An example would be a modifier that adds the {@code maxlen} attribute to the tag
+ * given a {@link Size} annotation.
+ *
+ * @author igor
+ *
+ */
+public interface ITagModifier<T extends Annotation>
+{
+ /**
+ * Modify the tag
+ *
+ * @param component
+ * component the tag belongs to
+ * @param tag
+ * markup tag to be modified
+ * @param annotation
+ * constraint annotation
+ */
+ void modify(FormComponent<?> component, ComponentTag tag, T annotation);
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/IViolationTranslator.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/IViolationTranslator.java b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/IViolationTranslator.java
new file mode 100644
index 0000000..299b105
--- /dev/null
+++ b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/IViolationTranslator.java
@@ -0,0 +1,24 @@
+package org.apache.wicket.bean.validation;
+
+import javax.validation.ConstraintViolation;
+
+import org.apache.wicket.validation.ValidationError;
+
+/**
+ * Converts {@link ConstraintViolation}s into Wicket's {@link ValidationError}s
+ *
+ * @author igor
+ *
+ */
+public interface IViolationTranslator
+{
+ /**
+ * Converts a {@link ConstraintViolation} into a {@link ValidationError}
+ *
+ * @param <T>
+ * @param violation
+ * constraint violation from bean validation
+ * @return validation validation error to be reported on the component
+ */
+ <T> ValidationError convert(ConstraintViolation<T> violation);
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/Property.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/Property.java b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/Property.java
new file mode 100644
index 0000000..cabe799
--- /dev/null
+++ b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/Property.java
@@ -0,0 +1,41 @@
+package org.apache.wicket.bean.validation;
+
+import java.io.Serializable;
+
+import org.apache.wicket.util.lang.Args;
+import org.apache.wicket.util.reference.ClassReference;
+
+/**
+ * A reference to a property that can be validated.
+ *
+ * @author igor
+ */
+public final class Property implements Serializable
+{
+ private final ClassReference<?> owner;
+ private final String name;
+
+ public Property(ClassReference<?> owner, String name)
+ {
+ Args.notNull(owner, "owner");
+ Args.notEmpty(name, "name");
+
+ this.owner = owner;
+ this.name = name;
+ }
+
+ public Property(Class<?> owner, String name)
+ {
+ this(ClassReference.of(owner), name);
+ }
+
+ public Class<?> getOwner()
+ {
+ return owner.get();
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java
new file mode 100644
index 0000000..ea843c1
--- /dev/null
+++ b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java
@@ -0,0 +1,219 @@
+package org.apache.wicket.bean.validation;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+import javax.validation.constraints.NotNull;
+import javax.validation.metadata.ConstraintDescriptor;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.behavior.Behavior;
+import org.apache.wicket.markup.ComponentTag;
+import org.apache.wicket.markup.html.form.FormComponent;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.validation.IValidatable;
+import org.apache.wicket.validation.IValidator;
+
+/**
+ * Validator that delegates to the bean validation framework. The integration has to be first
+ * configured using {@link BeanValidationConfiguration}.
+ *
+ * <p>
+ * The validator must be provided a {@link Property}, unless one can be resolved from the component
+ * implicitly. By default the configuration contains the {@link DefaultPropertyResolver} so
+ * {@link PropertyModel}s are supported out of the box - when attached to a component with a
+ * property model the property does not need to be specified explicitly.
+ * </p>
+ *
+ * <p>
+ * The validator will set the reqiured flag on the form component it is attached to based on the
+ * presence of the @NotNull annotation. Notice, the required flag will only be set to {@code true},
+ * components with the required flag already set to {@code true} will not have the flag set to
+ * {@code false} by this validator.
+ * </p>
+ *
+ * <p>
+ * The validator will allow {@link ITagModifier}s condigured in {@link BeanValidationConfiguration}
+ * to mutate the markup tag of the component it is attached to.
+ * </p>
+ *
+ * <p>
+ * The validator specifies default error messages in the {@code PropertyValidator.properties} file.
+ * These values can be overridden in the application subclass' property files globally or in the
+ * page or panel properties locally. See this file for the default messages supported.
+ * </p>
+ *
+ * @author igor
+ *
+ * @param <T>
+ */
+public class PropertyValidator<T> extends Behavior implements IValidator<T>
+{
+ private static Class<?>[] EMPTY = new Class<?>[0];
+
+ private FormComponent<T> component;
+ private Property property_;
+ private IModel<Class<?>[]> groups_;
+
+ public PropertyValidator(Class<?>... groups)
+ {
+ this(null, groups);
+ }
+
+ public PropertyValidator(IModel<Class<?>[]> groups)
+ {
+ this(null, groups);
+ }
+
+ public PropertyValidator(Property property, Class<?>... groups)
+ {
+ this(property, new GroupsModel(groups));
+ }
+
+ public PropertyValidator(Property property, IModel<Class<?>[]> groups)
+ {
+ this.property_ = property;
+ this.groups_ = groups;
+ }
+
+ private Property getProperty()
+ {
+ if (property_ == null)
+ {
+ property_ = BeanValidationConfiguration.get().resolveProperty(component);
+ if (property_ == null)
+ {
+ throw new IllegalStateException(
+ "Could not resolve Property from component: " +
+ component +
+ ". Either specify the Property in the constructor or use a model that works in combination with a " +
+ IPropertyResolver.class.getSimpleName() +
+ " to resolve the Property automatically");
+ }
+ }
+ return property_;
+ }
+
+ private Class<?>[] getGroups()
+ {
+ if (groups_ == null)
+ {
+ return EMPTY;
+ }
+ return groups_.getObject();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void bind(Component component)
+ {
+ if (this.component != null)
+ {
+ throw new IllegalStateException( //
+ "This validator has already been added to component: " + this.component +
+ ". This validator does not support reusing instances, please create a new one");
+ }
+
+ if (!(component instanceof FormComponent))
+ {
+ throw new IllegalStateException(getClass().getSimpleName() +
+ " can only be added to FormComponents");
+ }
+
+ // TODO add a validation key that appends the type so we can have differnet messages for
+ // @Size on String vs Collection - done but need to add a key for each superclass/interface
+
+ this.component = (FormComponent<T>)component;
+
+ setComponentRequiredFlag();
+ }
+
+
+ @Override
+ public void detach(Component component)
+ {
+ super.detach(component);
+ if (groups_ != null)
+ {
+ groups_.detach();
+ }
+ }
+
+ /**
+ * Marks the form component required if necessary
+ */
+ private void setComponentRequiredFlag()
+ {
+ BeanValidationContext config = BeanValidationConfiguration.get();
+ Validator validator = config.getValidator();
+ Property property = getProperty();
+
+ // if the property has a NotNull constraint mark the form component required
+
+ Iterator<ConstraintDescriptor<?>> it = new ConstraintIterator(validator, property);
+ while (it.hasNext())
+ {
+ ConstraintDescriptor<?> desc = it.next();
+ if (desc.getAnnotation().annotationType().equals(NotNull.class))
+ {
+ component.setRequired(true);
+ break;
+ }
+ }
+ }
+
+ @Override
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public void onComponentTag(Component component, ComponentTag tag)
+ {
+ super.onComponentTag(component, tag);
+
+ BeanValidationContext config = BeanValidationConfiguration.get();
+ Validator validator = config.getValidator();
+ Property property = getProperty();
+
+ // find any tag modifiers that apply to the constraints of the property being validated
+ // and allow them to modify the component tag
+
+ Iterator<ConstraintDescriptor<?>> it = new ConstraintIterator(validator, property,
+ getGroups());
+
+ while (it.hasNext())
+ {
+ ConstraintDescriptor<?> desc = it.next();
+
+ ITagModifier modifier = config.getTagModifier(desc.getAnnotation().annotationType());
+
+ if (modifier != null)
+ {
+ modifier.modify((FormComponent<?>)component, tag, desc.getAnnotation());
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void validate(IValidatable<T> validatable)
+ {
+ BeanValidationContext config = BeanValidationConfiguration.get();
+ Validator validator = config.getValidator();
+
+ Property property = getProperty();
+
+ // validate the value using the bean validator
+
+ Set<?> violations = validator.validateValue(property.getOwner(), property.getName(),
+ validatable.getValue(), getGroups());
+
+ // iterate over violations and report them
+
+ for (ConstraintViolation<?> violation : (Set<ConstraintViolation<?>>)violations)
+ {
+ validatable.error(config.getViolationTranslator().convert(violation));
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.properties
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.properties b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.properties
new file mode 100644
index 0000000..b706fc9
--- /dev/null
+++ b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.properties
@@ -0,0 +1,24 @@
+javax.validation.constraints.AssertFalse.message = '${label}' must be false
+javax.validation.constraints.AssertTrue.message = '${label}' must be true
+javax.validation.constraints.DecimalMax.message = '${label}' must be less than or equal to ${value}
+javax.validation.constraints.DecimalMin.message = '${label}' must be greater than or equal to ${value}
+javax.validation.constraints.Digits.message = '${label}' numeric value out of bounds (<${integer} digits>.<${fraction} digits> expected)
+javax.validation.constraints.Future.message = '${label}' must be in the future
+javax.validation.constraints.Max.message = '${label}' must be less than or equal to ${value}
+javax.validation.constraints.Min.message = '${label}' must be greater than or equal to ${value}
+javax.validation.constraints.NotNull.message = '${label}' may not be null
+javax.validation.constraints.Null.message = '${label}' must be null
+javax.validation.constraints.Past.message = '${label}' must be in the past
+javax.validation.constraints.Pattern.message = '${label}' must match "${regexp}"
+javax.validation.constraints.Size.message = '${label}' must be between ${min} and ${max}
+javax.validation.constraints.Size.message.String = '${label}' length must be between ${min} and ${max}
+
+org.hibernate.validator.constraints.CreditCardNumber.message = '${label}' is not a valid credit card number
+org.hibernate.validator.constraints.Email.message = '${label}' is not a well-formed email address
+org.hibernate.validator.constraints.Length.message = '${label}' length must be between ${min} and ${max}
+org.hibernate.validator.constraints.NotBlank.message = '${label}' may not be empty
+org.hibernate.validator.constraints.NotEmpty.message = '${label}' may not be empty
+org.hibernate.validator.constraints.Range.message = '${label}' must be between ${min} and ${max}
+org.hibernate.validator.constraints.SafeHtml.message = '${label}' may have unsafe html content
+org.hibernate.validator.constraints.ScriptAssert.message = '${label}' script expression "${script}" didn't evaluate to true
+org.hibernate.validator.constraints.URL.message = '${label}' is not a valid URL
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/SessionLocaleInterpolator.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/SessionLocaleInterpolator.java b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/SessionLocaleInterpolator.java
new file mode 100644
index 0000000..da3c0e9
--- /dev/null
+++ b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/SessionLocaleInterpolator.java
@@ -0,0 +1,54 @@
+package org.apache.wicket.bean.validation;
+
+import java.util.Locale;
+
+import javax.validation.MessageInterpolator;
+
+import org.apache.wicket.Session;
+
+/**
+ * {@link MessageInterpolator} that adapts another to a locale from Wicket's {@link Session}
+ *
+ * @author igor
+ */
+public class SessionLocaleInterpolator implements MessageInterpolator
+{
+ private final MessageInterpolator delegate;
+
+ /**
+ * Constructor
+ *
+ * @param delegate
+ */
+ public SessionLocaleInterpolator(MessageInterpolator delegate)
+ {
+ if (delegate == null)
+ {
+ throw new IllegalArgumentException("delegate cannot be null");
+ }
+ this.delegate = delegate;
+ }
+
+ public String interpolate(String messageTemplate, Context context)
+ {
+ final Locale locale = getLocale();
+ if (locale != null)
+ {
+ return delegate.interpolate(messageTemplate, context, locale);
+ }
+ else
+ {
+ return delegate.interpolate(messageTemplate, context);
+ }
+ }
+
+ public String interpolate(final String message, final Context context, final Locale locale)
+ {
+ return delegate.interpolate(message, context, locale);
+ }
+
+ private Locale getLocale()
+ {
+ return Session.exists() ? Session.get().getLocale() : null;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/SizeTagModifier.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/SizeTagModifier.java b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/SizeTagModifier.java
new file mode 100644
index 0000000..7d453af
--- /dev/null
+++ b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/SizeTagModifier.java
@@ -0,0 +1,26 @@
+package org.apache.wicket.bean.validation;
+
+import javax.validation.constraints.Size;
+
+import org.apache.wicket.markup.ComponentTag;
+import org.apache.wicket.markup.html.form.FormComponent;
+
+/**
+ * A tag modifier that adds the {@code maxlen} attribute to the {@code input} tag with the max value
+ * from the {@link Size} constraint annotation.
+ *
+ * @author igor
+ *
+ */
+public class SizeTagModifier implements ITagModifier<Size>
+{
+ @Override
+ public void modify(FormComponent<?> component, ComponentTag tag, Size annotation)
+ {
+ if ("input".equalsIgnoreCase(tag.getName()))
+ {
+ Size size = (Size)annotation;
+ tag.put("maxlen", size.max());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/580a8dd9/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/package.html
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/package.html b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/package.html
new file mode 100644
index 0000000..ea94c09
--- /dev/null
+++ b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/package.html
@@ -0,0 +1,52 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE HTML PUBLIC "-//W3C/DTD HTML 3.2 Final//NL">
+<html>
+<head>
+<title>Wicket Bean Validation Package</title>
+</head>
+<body>
+
+ <p>This package integrates bean validation framework into Wicket.</p>
+
+ <p>The integration is configured using BeanValidationConfiguration.
+ Usually this is done in Application's init method. Once the
+ configuration is intialized and customized, the final step is to call
+ configure passing in the application instance to be configured.</p>
+
+ <p>The configuration can be customized using the following
+ integration points:</p>
+ <ul>
+ <li><code>IPropertyResolver</code> - used to automatically figure
+ out which property is being validated given the form component
+ instance. By default all components using an
+ IPropertyReflectionAwareModel are supported.</li>
+ <li><code>IViolationTranslator</code> - converts bean validation
+ constraint violations to Wicket validation errors that are reported
+ on form components when validation fails.</li>
+ <li><code>ITagModifier</code> - An object that can modify the
+ form component's markup tag. Can be used to add html attributes to
+ tags based on constaint annotations.</li>
+ <li><code>Provider<Validator></code> - used as a factory
+ for the main Validator object instance that will be used to perform
+ the validation</li>
+ </ul>
+
+ <p>Once the application is configured form components can be
+ validated by adding a PropertyValidator.</p>
+</body>
+</html>
\ No newline at end of file