Return-Path: X-Original-To: apmail-incubator-bval-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-bval-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 44CC599A8 for ; Sat, 7 Jan 2012 22:29:19 +0000 (UTC) Received: (qmail 94558 invoked by uid 500); 7 Jan 2012 22:29:19 -0000 Delivered-To: apmail-incubator-bval-commits-archive@incubator.apache.org Received: (qmail 94522 invoked by uid 500); 7 Jan 2012 22:29:18 -0000 Mailing-List: contact bval-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: bval-dev@incubator.apache.org Delivered-To: mailing list bval-commits@incubator.apache.org Received: (qmail 94515 invoked by uid 99); 7 Jan 2012 22:29:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 07 Jan 2012 22:29:18 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 07 Jan 2012 22:29:13 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id CCC4F2388860; Sat, 7 Jan 2012 22:28:51 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1228744 - in /incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard: ./ AmericanExpress.java Diners.java Discover.java Mastercard.java Visa.java package-info.java Date: Sat, 07 Jan 2012 22:28:51 -0000 To: bval-commits@incubator.apache.org From: simonetripodi@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120107222851.CCC4F2388860@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: simonetripodi Date: Sat Jan 7 22:28:51 2012 New Revision: 1228744 URL: http://svn.apache.org/viewvc?rev=1228744&view=rev Log: added Credit Cards constraints, taking inspiration from apache commons-validations but implemented as constraints composition Added: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/ incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/AmericanExpress.java (with props) incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Diners.java (with props) incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Discover.java (with props) incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Mastercard.java (with props) incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Visa.java (with props) incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/package-info.java (with props) Added: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/AmericanExpress.java URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/AmericanExpress.java?rev=1228744&view=auto ============================================================================== --- incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/AmericanExpress.java (added) +++ incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/AmericanExpress.java Sat Jan 7 22:28:51 2012 @@ -0,0 +1,59 @@ +/* + * 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.extras.constraints.creditcard; + +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import javax.validation.Constraint; +import javax.validation.Payload; +import javax.validation.constraints.Pattern; + +import org.apache.bval.extras.constraints.checkdigit.Luhn; + +/** + *

+ * -- + * TODO - 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. + * -- + *

+ * Description: annotation to validate a java.io.File is a directory
+ */ +@Documented +@Luhn +@Pattern(regexp="^(3[47]\\d{13})$") +@Constraint(validatedBy={}) +@Target( { FIELD, ANNOTATION_TYPE, PARAMETER } ) +@Retention( RUNTIME ) +public @interface AmericanExpress { + + Class[] groups() default {}; + + String message() default "{org.apache.bval.extras.constraints.creditcard.AmericanExpress.message}"; + + Class[] payload() default {}; + +} Propchange: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/AmericanExpress.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/AmericanExpress.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Propchange: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/AmericanExpress.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Diners.java URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Diners.java?rev=1228744&view=auto ============================================================================== --- incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Diners.java (added) +++ incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Diners.java Sat Jan 7 22:28:51 2012 @@ -0,0 +1,59 @@ +/* + * 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.extras.constraints.creditcard; + +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import javax.validation.Constraint; +import javax.validation.Payload; +import javax.validation.constraints.Pattern; + +import org.apache.bval.extras.constraints.checkdigit.Luhn; + +/** + *

+ * -- + * TODO - 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. + * -- + *

+ * Description: annotation to validate a java.io.File is a directory
+ */ +@Documented +@Luhn +@Pattern(regexp="^(30[0-5]\\d{11}|3095\\d{10}|36\\d{12}|3[8-9]\\d{12})$") +@Constraint(validatedBy={}) +@Target( { FIELD, ANNOTATION_TYPE, PARAMETER } ) +@Retention( RUNTIME ) +public @interface Diners { + + Class[] groups() default {}; + + String message() default "{org.apache.bval.extras.constraints.creditcard.Diners.message}"; + + Class[] payload() default {}; + +} Propchange: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Diners.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Diners.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Propchange: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Diners.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Discover.java URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Discover.java?rev=1228744&view=auto ============================================================================== --- incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Discover.java (added) +++ incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Discover.java Sat Jan 7 22:28:51 2012 @@ -0,0 +1,59 @@ +/* + * 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.extras.constraints.creditcard; + +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import javax.validation.Constraint; +import javax.validation.Payload; +import javax.validation.constraints.Pattern; + +import org.apache.bval.extras.constraints.checkdigit.Luhn; + +/** + *

+ * -- + * TODO - 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. + * -- + *

+ * Description: annotation to validate a java.io.File is a directory
+ */ +@Documented +@Luhn +@Pattern(regexp="^((6011\\d{12})|(64[4-9]\\d{13})|(65\\d{14}))$") +@Constraint(validatedBy={}) +@Target( { FIELD, ANNOTATION_TYPE, PARAMETER } ) +@Retention( RUNTIME ) +public @interface Discover { + + Class[] groups() default {}; + + String message() default "{org.apache.bval.extras.constraints.creditcard.Discover.message}"; + + Class[] payload() default {}; + +} Propchange: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Discover.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Discover.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Propchange: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Discover.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Mastercard.java URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Mastercard.java?rev=1228744&view=auto ============================================================================== --- incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Mastercard.java (added) +++ incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Mastercard.java Sat Jan 7 22:28:51 2012 @@ -0,0 +1,59 @@ +/* + * 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.extras.constraints.creditcard; + +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import javax.validation.Constraint; +import javax.validation.Payload; +import javax.validation.constraints.Pattern; + +import org.apache.bval.extras.constraints.checkdigit.Luhn; + +/** + *

+ * -- + * TODO - 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. + * -- + *

+ * Description: annotation to validate a java.io.File is a directory
+ */ +@Documented +@Luhn +@Pattern(regexp="^(5[1-5]\\d{14})$") +@Constraint(validatedBy={}) +@Target( { FIELD, ANNOTATION_TYPE, PARAMETER } ) +@Retention( RUNTIME ) +public @interface Mastercard { + + Class[] groups() default {}; + + String message() default "{org.apache.bval.extras.constraints.creditcard.Mastercard.message}"; + + Class[] payload() default {}; + +} Propchange: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Mastercard.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Mastercard.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Propchange: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Mastercard.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Visa.java URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Visa.java?rev=1228744&view=auto ============================================================================== --- incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Visa.java (added) +++ incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Visa.java Sat Jan 7 22:28:51 2012 @@ -0,0 +1,59 @@ +/* + * 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.extras.constraints.creditcard; + +import static java.lang.annotation.ElementType.ANNOTATION_TYPE; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import javax.validation.Constraint; +import javax.validation.Payload; +import javax.validation.constraints.Pattern; + +import org.apache.bval.extras.constraints.checkdigit.Luhn; + +/** + *

+ * -- + * TODO - 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. + * -- + *

+ * Description: annotation to validate a java.io.File is a directory
+ */ +@Documented +@Luhn +@Pattern(regexp="^(4)(\\d{12}|\\d{15})$") +@Constraint(validatedBy={}) +@Target( { FIELD, ANNOTATION_TYPE, PARAMETER } ) +@Retention( RUNTIME ) +public @interface Visa { + + Class[] groups() default {}; + + String message() default "{org.apache.bval.extras.constraints.creditcard.Visa.message}"; + + Class[] payload() default {}; + +} Propchange: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Visa.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Visa.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Propchange: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/Visa.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/package-info.java URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/package-info.java?rev=1228744&view=auto ============================================================================== --- incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/package-info.java (added) +++ incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/package-info.java Sat Jan 7 22:28:51 2012 @@ -0,0 +1,23 @@ +/* + * 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. + */ + +/** + * This package contains Credit Card validation routines. + */ +package org.apache.bval.extras.constraints.creditcard; Propchange: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/package-info.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/package-info.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Propchange: incubator/bval/trunk/bval-extras/src/main/java/org/apache/bval/extras/constraints/creditcard/package-info.java ------------------------------------------------------------------------------ svn:mime-type = text/plain