incubator-bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r928387 [6/15] - in /incubator/bval/trunk: ./ agimatec-jsr303/ agimatec-validation/ bval-core/ bval-core/.externalToolBuilders/ bval-core/.settings/ bval-core/src/ bval-core/src/main/ bval-core/src/main/java/ bval-core/src/main/java/org/ bv...
Date Sun, 28 Mar 2010 12:28:32 GMT
Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/MinValidatorForString.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/MinValidatorForString.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/MinValidatorForString.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/MinValidatorForString.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,48 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.constraints.Min;
+import java.math.BigDecimal;
+
+/**
+ * Check that the String being validated represents a number, and has a value
+ * more than or equal to the minimum value specified.
+ */
+public class MinValidatorForString implements ConstraintValidator<Min, String> {
+
+    private long minValue;
+
+    public void initialize(Min annotation) {
+        this.minValue = annotation.value();
+    }
+
+    public boolean isValid(String value, ConstraintValidatorContext context) {
+        if (value == null) {
+            return true;
+        }
+        try {
+            return new BigDecimal(value).compareTo(BigDecimal.valueOf(minValue)) != -1;
+        } catch (NumberFormatException nfe) {
+            return false;
+        }
+    }
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/MinValidatorForString.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/MinValidatorForString.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/MinValidatorForString.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmpty.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmpty.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmpty.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmpty.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,47 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.*;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * <pre>
+ * This class is NOT part of the bean_validation spec and might disappear
+ * as soon as a final version of the specification contains a similar functionality.
+ * </pre>
+ */
+@Documented
+@Constraint(
+      validatedBy = {NotEmptyValidatorForCollection.class, NotEmptyValidatorForMap.class,
+            NotEmptyValidatorForString.class, NotEmptyValidator.class})
+@Target({METHOD, FIELD, ANNOTATION_TYPE, PARAMETER})
+@Retention(RUNTIME)
+public @interface NotEmpty {
+    Class<?>[] groups() default {};
+
+    String message() default "{org.apache.bval.constraints.NotEmpty.message}";
+
+    Class<? extends Payload>[] payload() default {};
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmpty.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmpty.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmpty.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidator.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidator.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidator.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidator.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,51 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+
+/**
+ * Description:  Check the non emptyness of an
+ * any object that has a public isEmpty():boolean or a valid toString() method
+ */
+public class NotEmptyValidator implements ConstraintValidator<NotEmpty, Object> {
+    public void initialize(NotEmpty constraintAnnotation) {
+        // do nothing
+    }
+
+    public boolean isValid(Object value, ConstraintValidatorContext context) {
+        if (value == null) return true;
+        if (value.getClass().isArray()) {
+            return Array.getLength(value) > 0;
+        } else {
+            try {
+                Method isEmptyMethod = value.getClass().getMethod("isEmpty");
+                if (isEmptyMethod != null) {
+                    return !((Boolean) isEmptyMethod.invoke(value)).booleanValue();
+                }
+            } catch (Exception ex) {
+                // do nothing
+            }
+            return value.toString().length() > 0;
+        }
+    }
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForCollection.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForCollection.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForCollection.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForCollection.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,40 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import java.util.Collection;
+
+/**
+ * Description: <br/>
+ * User: roman <br/>
+ * Date: 18.11.2009 <br/>
+ * Time: 14:03:12 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public class NotEmptyValidatorForCollection implements ConstraintValidator<NotEmpty, Collection> {
+    public void initialize(NotEmpty constraintAnnotation) {
+        // do nothing
+    }
+
+    public boolean isValid(Collection value, ConstraintValidatorContext context) {
+        return value == null || !value.isEmpty();
+    }
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForCollection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForCollection.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForCollection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForMap.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForMap.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForMap.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForMap.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,40 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import java.util.Map;
+
+/**
+ * Description: <br/>
+ * User: roman <br/>
+ * Date: 18.11.2009 <br/>
+ * Time: 14:02:57 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public class NotEmptyValidatorForMap implements ConstraintValidator<NotEmpty, Map> {
+    public void initialize(NotEmpty constraintAnnotation) {
+        // do nothing
+    }
+
+    public boolean isValid(Map value, ConstraintValidatorContext context) {
+        return value == null || !value.isEmpty();
+    }
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForMap.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForMap.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForString.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForString.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForString.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForString.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,39 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+/**
+ * Description: <br/>
+ * User: roman <br/>
+ * Date: 18.11.2009 <br/>
+ * Time: 14:03:22 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public class NotEmptyValidatorForString implements ConstraintValidator<NotEmpty, String> {
+    public void initialize(NotEmpty constraintAnnotation) {
+        // do nothing
+    }
+
+    public boolean isValid(String value, ConstraintValidatorContext context) {
+        return value == null || value.length() > 0;
+    }
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForString.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForString.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotEmptyValidatorForString.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotNullValidator.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotNullValidator.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotNullValidator.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotNullValidator.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,34 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.constraints.NotNull;
+
+/** valid when object is NOT null */
+public class NotNullValidator implements ConstraintValidator<NotNull, Object> {
+    public void initialize(NotNull constraintAnnotation) {
+        // do nothing
+    }
+
+    public boolean isValid(Object value, ConstraintValidatorContext context) {
+        return value != null;
+    }
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotNullValidator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotNullValidator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NotNullValidator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NullValidator.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NullValidator.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NullValidator.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NullValidator.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,41 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.constraints.Null;
+
+/**
+ * Description: valid when object is null<br/>
+ * User: roman <br/>
+ * Date: 03.02.2009 <br/>
+ * Time: 12:49:08 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public class NullValidator implements ConstraintValidator<Null, Object> {
+
+    public void initialize(Null annotation) {
+        // do nothing
+    }
+
+    public boolean isValid(Object object, ConstraintValidatorContext context) {
+        return object == null;
+    }
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NullValidator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NullValidator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/NullValidator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PastValidatorForCalendar.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PastValidatorForCalendar.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PastValidatorForCalendar.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PastValidatorForCalendar.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,51 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.constraints.Past;
+import java.util.Calendar;
+
+/**
+ * Description: validate a date or calendar representing a date in the past<br/>
+ * User: roman <br/>
+ * Date: 03.02.2009 <br/>
+ * Time: 12:49:16 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public class PastValidatorForCalendar implements ConstraintValidator<Past, Calendar> {
+
+    public void initialize(Past annotation) {
+    }
+
+    public boolean isValid(Calendar cal, ConstraintValidatorContext context) {
+        return cal == null || cal.before(now());
+    }
+
+
+    /**
+     * overwrite when you need a different algorithm for 'now'.
+     *
+     * @return current date/time
+     */
+    protected Calendar now() {
+        return Calendar.getInstance();
+    }
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PastValidatorForCalendar.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PastValidatorForCalendar.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PastValidatorForCalendar.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PastValidatorForDate.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PastValidatorForDate.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PastValidatorForDate.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PastValidatorForDate.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,50 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.constraints.Past;
+import java.util.Date;
+
+/**
+ * Description: validate a date or calendar representing a date in the past<br/>
+ * User: roman <br/>
+ * Date: 03.02.2009 <br/>
+ * Time: 12:49:16 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public class PastValidatorForDate implements ConstraintValidator<Past, Date> {
+
+    public void initialize(Past annotation) {
+    }
+
+    public boolean isValid(Date date, ConstraintValidatorContext context) {
+        return date == null || date.before(now());
+    }
+
+    /**
+     * overwrite when you need a different algorithm for 'now'.
+     *
+     * @return current date/time
+     */
+    protected Date now() {
+        return new Date();
+    }
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PastValidatorForDate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PastValidatorForDate.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PastValidatorForDate.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PatternValidator.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PatternValidator.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PatternValidator.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PatternValidator.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,51 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.constraints.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+/**
+ * validator using a regular expression,
+ * based on the jsr303 Pattern constraint annotation.
+ */
+public class PatternValidator implements ConstraintValidator<Pattern, String> {
+    protected java.util.regex.Pattern pattern;
+
+    public void initialize(Pattern annotation) {
+        Pattern.Flag flags[] = annotation.flags();
+        int intFlag = 0;
+        for (Pattern.Flag flag : flags) {
+            intFlag = intFlag | flag.getValue();
+        }
+
+        try {
+            pattern = java.util.regex.Pattern.compile(annotation.regexp(), intFlag);
+        } catch (PatternSyntaxException e) {
+            throw new IllegalArgumentException("Invalid regular expression.", e);
+        }
+    }
+
+
+    public boolean isValid(String value, ConstraintValidatorContext context) {
+        return value == null || pattern.matcher(value).matches();
+    }
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PatternValidator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PatternValidator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/PatternValidator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidator.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidator.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidator.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidator.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,48 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ValidationException;
+import javax.validation.constraints.Size;
+
+/**
+ * Description: Abstract validator impl. for @Size annotation<br/>
+ * User: roman <br/>
+ * Date: 03.02.2009 <br/>
+ * Time: 12:49:24 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public abstract class SizeValidator {
+    protected int min;
+    protected int max;
+
+    /**
+     * Configure the constraint validator based on the elements
+     * specified at the time it was defined.
+     *
+     * @param constraint the constraint definition
+     */
+    public void initialize(Size constraint) {
+        min = constraint.min();
+        max = constraint.max();
+        if (min < 0) throw new ValidationException("Min cannot be negative");
+        if (max < 0) throw new ValidationException("Max cannot be negative");
+        if (max < min) throw new ValidationException("Max cannot be less than Min");
+    }
+}
\ No newline at end of file

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfBoolean.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfBoolean.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfBoolean.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfBoolean.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,45 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.constraints.Size;
+import java.lang.reflect.Array;
+
+public class SizeValidatorForArrayOfBoolean extends SizeValidator
+      implements ConstraintValidator<Size, boolean[]> {
+
+    /**
+     * Checks the number of entries in an array.
+     *
+     * @param array   The array to validate.
+     * @param context context in which the constraint is evaluated.
+     * @return Returns <code>true</code> if the array is <code>null</code> or the number of entries in
+     *         <code>array</code> is between the specified <code>min</code> and <code>max</code> values (inclusive),
+     *         <code>false</code> otherwise.
+     */
+    public boolean isValid(boolean[] array, ConstraintValidatorContext context) {
+        if (array == null) {
+            return true;
+        }
+        int length = Array.getLength(array);
+        return length >= min && length <= max;
+	}
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfBoolean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfBoolean.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfBoolean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfByte.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfByte.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfByte.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfByte.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,45 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.constraints.Size;
+import java.lang.reflect.Array;
+
+public class SizeValidatorForArrayOfByte extends SizeValidator
+      implements ConstraintValidator<Size, byte[]> {
+
+    /**
+     * Checks the number of entries in an array.
+     *
+     * @param array   The array to validate.
+     * @param context context in which the constraint is evaluated.
+     * @return Returns <code>true</code> if the array is <code>null</code> or the number of entries in
+     *         <code>array</code> is between the specified <code>min</code> and <code>max</code> values (inclusive),
+     *         <code>false</code> otherwise.
+     */
+    public boolean isValid(byte[] array, ConstraintValidatorContext context) {
+        if (array == null) {
+            return true;
+        }
+        int length = Array.getLength(array);
+        return length >= min && length <= max;
+	}
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfByte.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfByte.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfByte.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfChar.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfChar.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfChar.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfChar.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,45 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.constraints.Size;
+import java.lang.reflect.Array;
+
+public class SizeValidatorForArrayOfChar extends SizeValidator
+      implements ConstraintValidator<Size, char[]> {
+
+    /**
+     * Checks the number of entries in an array.
+     *
+     * @param array   The array to validate.
+     * @param context context in which the constraint is evaluated.
+     * @return Returns <code>true</code> if the array is <code>null</code> or the number of entries in
+     *         <code>array</code> is between the specified <code>min</code> and <code>max</code> values (inclusive),
+     *         <code>false</code> otherwise.
+     */
+    public boolean isValid(char[] array, ConstraintValidatorContext context) {
+        if (array == null) {
+            return true;
+        }
+        int length = Array.getLength(array);
+        return length >= min && length <= max;
+	}
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfChar.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfChar.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfChar.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfDouble.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfDouble.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfDouble.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfDouble.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,45 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.constraints.Size;
+import java.lang.reflect.Array;
+
+public class SizeValidatorForArrayOfDouble extends SizeValidator
+      implements ConstraintValidator<Size, double[]> {
+
+    /**
+     * Checks the number of entries in an array.
+     *
+     * @param array   The array to validate.
+     * @param context context in which the constraint is evaluated.
+     * @return Returns <code>true</code> if the array is <code>null</code> or the number of entries in
+     *         <code>array</code> is between the specified <code>min</code> and <code>max</code> values (inclusive),
+     *         <code>false</code> otherwise.
+     */
+    public boolean isValid(double[] array, ConstraintValidatorContext context) {
+        if (array == null) {
+            return true;
+        }
+        int length = Array.getLength(array);
+        return length >= min && length <= max;
+	}
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfDouble.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfDouble.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfDouble.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfFloat.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfFloat.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfFloat.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfFloat.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,45 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.constraints.Size;
+import java.lang.reflect.Array;
+
+public class SizeValidatorForArrayOfFloat extends SizeValidator
+      implements ConstraintValidator<Size, float[]> {
+
+    /**
+     * Checks the number of entries in an array.
+     *
+     * @param array   The array to validate.
+     * @param context context in which the constraint is evaluated.
+     * @return Returns <code>true</code> if the array is <code>null</code> or the number of entries in
+     *         <code>array</code> is between the specified <code>min</code> and <code>max</code> values (inclusive),
+     *         <code>false</code> otherwise.
+     */
+    public boolean isValid(float[] array, ConstraintValidatorContext context) {
+        if (array == null) {
+            return true;
+        }
+        int length = Array.getLength(array);
+        return length >= min && length <= max;
+	}
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfFloat.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfFloat.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfFloat.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfInt.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfInt.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfInt.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfInt.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,45 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.constraints.Size;
+import java.lang.reflect.Array;
+
+public class SizeValidatorForArrayOfInt extends SizeValidator
+      implements ConstraintValidator<Size, int[]> {
+
+    /**
+     * Checks the number of entries in an array.
+     *
+     * @param array   The array to validate.
+     * @param context context in which the constraint is evaluated.
+     * @return Returns <code>true</code> if the array is <code>null</code> or the number of entries in
+     *         <code>array</code> is between the specified <code>min</code> and <code>max</code> values (inclusive),
+     *         <code>false</code> otherwise.
+     */
+    public boolean isValid(int[] array, ConstraintValidatorContext context) {
+        if (array == null) {
+            return true;
+        }
+        int length = Array.getLength(array);
+        return length >= min && length <= max;
+	}
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfInt.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfInt.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfInt.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfLong.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfLong.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfLong.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfLong.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,45 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.constraints.Size;
+import java.lang.reflect.Array;
+
+public class SizeValidatorForArrayOfLong extends SizeValidator
+      implements ConstraintValidator<Size, long[]> {
+
+    /**
+     * Checks the number of entries in an array.
+     *
+     * @param array   The array to validate.
+     * @param context context in which the constraint is evaluated.
+     * @return Returns <code>true</code> if the array is <code>null</code> or the number of entries in
+     *         <code>array</code> is between the specified <code>min</code> and <code>max</code> values (inclusive),
+     *         <code>false</code> otherwise.
+     */
+    public boolean isValid(long[] array, ConstraintValidatorContext context) {
+        if (array == null) {
+            return true;
+        }
+        int length = Array.getLength(array);
+        return length >= min && length <= max;
+	}
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfLong.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfLong.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfLong.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfObject.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfObject.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfObject.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfObject.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,46 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.constraints.Size;
+import java.lang.reflect.Array;
+
+/** Check that the length of an array is between <i>min</i> and <i>max</i> */
+public class SizeValidatorForArrayOfObject extends SizeValidator
+      implements ConstraintValidator<Size, Object[]> {
+    /**
+     * Checks the number of entries in an array.
+     *
+     * @param array   The array to validate.
+     * @param context context in which the constraint is evaluated.
+     * @return Returns <code>true</code> if the array is <code>null</code> or the number of entries in
+     *         <code>array</code> is between the specified <code>min</code> and <code>max</code> values (inclusive),
+     *         <code>false</code> otherwise.
+     */
+    public boolean isValid(Object[] array, ConstraintValidatorContext context) {
+        if (array == null) {
+            return true;
+        }
+        int length = Array.getLength(array);
+        return length >= min && length <= max;
+    }
+
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfObject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfObject.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfObject.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfShort.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfShort.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfShort.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfShort.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,45 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.constraints.Size;
+import java.lang.reflect.Array;
+
+public class SizeValidatorForArrayOfShort extends SizeValidator
+      implements ConstraintValidator<Size, short[]> {
+
+    /**
+     * Checks the number of entries in an array.
+     *
+     * @param array   The array to validate.
+     * @param context context in which the constraint is evaluated.
+     * @return Returns <code>true</code> if the array is <code>null</code> or the number of entries in
+     *         <code>array</code> is between the specified <code>min</code> and <code>max</code> values (inclusive),
+     *         <code>false</code> otherwise.
+     */
+    public boolean isValid(short[] array, ConstraintValidatorContext context) {
+        if (array == null) {
+            return true;
+        }
+        int length = Array.getLength(array);
+        return length >= min && length <= max;
+	}
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfShort.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfShort.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForArrayOfShort.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForCollection.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForCollection.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForCollection.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForCollection.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,47 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.constraints.Size;
+import java.util.Collection;
+
+/** Check that a Collection's size is between min and max. */
+public class SizeValidatorForCollection extends SizeValidator
+      implements ConstraintValidator<Size, Collection> {
+
+    /**
+     * Checks the number of entries in a map.
+     *
+     * @param collection The collection to validate.
+     * @param context    context in which the constraint is evaluated.
+     * @return Returns <code>true</code> if the collection is <code>null</code> or the number of entries in
+     *         <code>collection</code> is between the specified <code>min</code> and <code>max</code> values (inclusive),
+     *         <code>false</code> otherwise.
+     */
+    public boolean isValid(Collection collection, ConstraintValidatorContext context) {
+        if (collection == null) {
+            return true;
+        }
+        int length = collection.size();
+        return length >= min && length <= max;
+    }
+
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForCollection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForCollection.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForCollection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForMap.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForMap.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForMap.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForMap.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,46 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.constraints.Size;
+import java.util.Map;
+
+/** Check that a Map's size is between min and max. */
+public class SizeValidatorForMap extends SizeValidator
+      implements ConstraintValidator<Size, Map> {
+    /**
+     * Checks the number of entries in a map.
+     *
+     * @param map     The map to validate.
+     * @param context context in which the constraint is evaluated.
+     * @return Returns <code>true</code> if the map is <code>null</code> or the number of entries in <code>map</code>
+     *         is between the specified <code>min</code> and <code>max</code> values (inclusive),
+     *         <code>false</code> otherwise.
+     */
+    public boolean isValid(Map map, ConstraintValidatorContext context) {
+        if (map == null) {
+            return true;
+        }
+        int size = map.size();
+        return size >= min && size <= max;
+	}
+
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForMap.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForMap.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForString.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForString.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForString.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForString.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,44 @@
+/*
+ * 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.bval.constraints;
+
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+import javax.validation.constraints.Size;
+
+/** Check that a string's length is between min and max. */
+public class SizeValidatorForString extends SizeValidator
+      implements ConstraintValidator<Size, String> {
+    /**
+     * Checks the length of the specified string.
+     *
+     * @param s       The string to validate.
+     * @param context context in which the constraint is evaluated.
+     * @return Returns <code>true</code> if the string is <code>null</code> or the length of <code>s</code> between the specified
+     *         <code>min</code> and <code>max</code> values (inclusive), <code>false</code> otherwise.
+     */
+    public boolean isValid(String s, ConstraintValidatorContext context) {
+        if (s == null) {
+            return true;
+        }
+        int length = s.length();
+        return length >= min && length <= max;
+    }
+
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForString.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForString.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/constraints/SizeValidatorForString.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecFactoryContext.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecFactoryContext.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecFactoryContext.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecFactoryContext.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,132 @@
+/*
+ * 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.bval.jsr303;
+
+import org.apache.bval.*;
+
+import javax.validation.*;
+
+import org.apache.bval.IntrospectorMetaBeanFactory;
+import org.apache.bval.MetaBeanBuilder;
+import org.apache.bval.MetaBeanFactory;
+import org.apache.bval.MetaBeanFinder;
+import org.apache.bval.MetaBeanManager;
+import org.apache.bval.xml.XMLMetaBeanFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Description: Represents the context that is used to create <code>ClassValidator</code>
+ * instances.<br/>
+ * User: roman <br/>
+ * Date: 01.10.2009 <br/>
+ * Time: 16:35:25 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public class AgimatecFactoryContext implements ValidatorContext {
+    private final AgimatecValidatorFactory factory;
+    private final MetaBeanFinder metaBeanFinder;
+
+    private MessageInterpolator messageInterpolator;
+    private TraversableResolver traversableResolver;
+    private ConstraintValidatorFactory constraintValidatorFactory;
+
+    public AgimatecFactoryContext(AgimatecValidatorFactory factory) {
+        this.factory = factory;
+        this.metaBeanFinder = buildMetaBeanManager();
+    }
+
+    protected AgimatecFactoryContext(AgimatecValidatorFactory factory,
+                                     MetaBeanFinder metaBeanFinder) {
+        this.factory = factory;
+        this.metaBeanFinder = metaBeanFinder;
+    }
+
+    public AgimatecValidatorFactory getFactory() {
+        return factory;
+    }
+
+    public final MetaBeanFinder getMetaBeanFinder() {
+        return metaBeanFinder;
+    }
+
+    public ValidatorContext messageInterpolator(MessageInterpolator messageInterpolator) {
+        this.messageInterpolator = messageInterpolator;
+        return this;
+    }
+
+    public ValidatorContext traversableResolver(TraversableResolver traversableResolver) {
+        this.traversableResolver = traversableResolver;
+        return this;
+    }
+
+    public ValidatorContext constraintValidatorFactory(
+          ConstraintValidatorFactory constraintValidatorFactory) {
+        this.constraintValidatorFactory = constraintValidatorFactory;
+        return this;
+    }
+
+    public ConstraintValidatorFactory getConstraintValidatorFactory() {
+        return constraintValidatorFactory == null ? factory.getConstraintValidatorFactory() :
+              constraintValidatorFactory;
+    }
+
+    public Validator getValidator() {
+        ClassValidator validator = new ClassValidator(this);
+        if (Boolean.getBoolean(factory.getProperties().get(
+              AgimatecValidatorConfiguration.Properties.TREAT_MAPS_LIKE_BEANS))) {
+            validator.setTreatMapsLikeBeans(true);
+        }
+        return validator;
+    }
+
+    public MessageInterpolator getMessageInterpolator() {
+        return messageInterpolator == null ? factory.getMessageInterpolator() :
+              messageInterpolator;
+    }
+
+    public TraversableResolver getTraversableResolver() {
+        return traversableResolver == null ? factory.getTraversableResolver() :
+              traversableResolver;
+    }
+
+    /**
+     * Create MetaBeanManager that
+     * uses JSR303-XML + JSR303-Annotations
+     * to build meta-data from.
+     */
+    private MetaBeanManager buildMetaBeanManager() {
+        // this is relevant: xml before annotations
+        // (because ignore-annotations settings in xml)
+        List<MetaBeanFactory> builders = new ArrayList(3);
+        if (Boolean.parseBoolean(factory.getProperties().get(
+              AgimatecValidatorConfiguration.Properties.ENABLE_INTROSPECTOR))) {
+            builders.add(new IntrospectorMetaBeanFactory());
+        }
+        builders.add(new Jsr303MetaBeanFactory(this));
+
+        if (Boolean.parseBoolean(factory.getProperties().get(
+              AgimatecValidatorConfiguration.Properties.ENABLE_METABEANS_XML))) {
+            builders.add(new XMLMetaBeanFactory());
+        }
+        return new MetaBeanManager(
+              new MetaBeanBuilder(builders.toArray(new MetaBeanFactory[builders.size()])));
+    }
+}
\ No newline at end of file

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecFactoryContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecFactoryContext.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecFactoryContext.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecValidationProvider.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecValidationProvider.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecValidationProvider.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecValidationProvider.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,65 @@
+/*
+ * 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.bval.jsr303;
+
+import javax.validation.Configuration;
+import javax.validation.ValidationException;
+import javax.validation.spi.BootstrapState;
+import javax.validation.spi.ConfigurationState;
+import javax.validation.spi.ValidationProvider;
+
+/**
+ * Description: Implementation of {@link ValidationProvider} for jsr303 implementation of
+ * the agimatec-validation framework.
+ * <p/>
+ * <br/>
+ * User: roman.stumm <br/>
+ * Date: 29.10.2008 <br/>
+ * Time: 14:45:41 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public class AgimatecValidationProvider
+      implements ValidationProvider<AgimatecValidatorConfiguration> {
+    public boolean isSuitable(Class<? extends Configuration<?>> builderClass) {
+        return AgimatecValidatorConfiguration.class == builderClass;
+    }
+
+    public ConfigurationImpl createSpecializedConfiguration(BootstrapState state) {
+        return new ConfigurationImpl(state, this);
+    }
+
+    public Configuration<?> createGenericConfiguration(BootstrapState state) {
+        return new ConfigurationImpl(state, null);
+    }
+
+    /**
+     * @throws javax.validation.ValidationException
+     *          if the ValidatorFactory cannot be built
+     */
+    public AgimatecValidatorFactory buildValidatorFactory(ConfigurationState configuration) {
+        try {
+            AgimatecValidatorFactory factory = new AgimatecValidatorFactory();
+            factory.configure(configuration);
+            return factory;
+        } catch (RuntimeException ex) {
+            throw new ValidationException("error building ValidatorFactory", ex);
+        }
+    }
+
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecValidationProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecValidationProvider.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecValidationProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecValidatorConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecValidatorConfiguration.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecValidatorConfiguration.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecValidatorConfiguration.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,67 @@
+/*
+ * 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.bval.jsr303;
+
+import javax.validation.Configuration;
+
+/**
+ * Description: Uniquely identify Agimatec Validation in the Bean Validation bootstrap
+ * strategy. Also contains agimatec validation specific configurations<br/>
+ * User: roman.stumm <br/>
+ * Date: 28.10.2008 <br/>
+ * Time: 16:16:45 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public interface AgimatecValidatorConfiguration
+      extends Configuration<AgimatecValidatorConfiguration> {
+
+    /**
+     * proprietary property keys for {@link ConfigurationImpl}  
+     */
+    public interface Properties {
+        /**
+         * the location where to look for the validation.xml file.
+         * default: "META-INF/validation.xml"
+         */
+        String VALIDATION_XML_PATH = "agimatec.validation-xml-path";
+
+        /**
+         * true/false. use Introspector (java beans) metadata additionally
+         * to build metadata with JSR303.<br>
+         * This means that all properties exist that are java-bean properties and
+         * and that some features (Hidden, Readonly) are taken from Introspector
+         * to create the meta data.<br>
+         * default: false
+         */
+        String ENABLE_INTROSPECTOR = "agimatec.enable-introspector";
+
+        /**
+         * true/false. use agimatec metaBeans xml format additionally to
+         * build metadata with JSR303.
+         * default: false
+         */
+        String ENABLE_METABEANS_XML = "agimatec.enable-metabeans-xml";
+
+        /**
+         * BeanValidator.treatMapsLikeBeans.
+         * default: false 
+         */
+         String TREAT_MAPS_LIKE_BEANS = "agimatec.treat-maps-like-beans";
+    }
+}

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecValidatorConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecValidatorConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-jsr303/src/main/java/org/apache/bval/jsr303/AgimatecValidatorConfiguration.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message