Return-Path: Delivered-To: apmail-incubator-bval-commits-archive@minotaur.apache.org Received: (qmail 7504 invoked from network); 8 Sep 2010 02:37:09 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 8 Sep 2010 02:37:09 -0000 Received: (qmail 50801 invoked by uid 500); 8 Sep 2010 02:37:09 -0000 Delivered-To: apmail-incubator-bval-commits-archive@incubator.apache.org Received: (qmail 50775 invoked by uid 500); 8 Sep 2010 02:37:09 -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 50768 invoked by uid 99); 8 Sep 2010 02:37:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Sep 2010 02:37:08 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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; Wed, 08 Sep 2010 02:37:07 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 750F523889B3; Wed, 8 Sep 2010 02:36:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r993587 - /incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationProxyBuilder.java Date: Wed, 08 Sep 2010 02:36:47 -0000 To: bval-commits@incubator.apache.org From: mbenson@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100908023647.750F523889B3@eris.apache.org> Author: mbenson Date: Wed Sep 8 02:36:47 2010 New Revision: 993587 URL: http://svn.apache.org/viewvc?rev=993587&view=rev Log: format; organize imports Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationProxyBuilder.java Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationProxyBuilder.java URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationProxyBuilder.java?rev=993587&r1=993586&r2=993587&view=diff ============================================================================== --- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationProxyBuilder.java (original) +++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/xml/AnnotationProxyBuilder.java Wed Sep 8 02:36:47 2010 @@ -16,11 +16,6 @@ */ package org.apache.bval.jsr303.xml; - -import org.apache.bval.jsr303.util.SecureActions; - -import javax.validation.Payload; -import javax.validation.ValidationException; import java.lang.annotation.Annotation; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; @@ -29,13 +24,20 @@ import java.lang.reflect.Proxy; import java.util.HashMap; import java.util.Map; +import javax.validation.Payload; +import javax.validation.ValidationException; + +import org.apache.bval.jsr303.util.SecureActions; + /** - * Description: Holds the information and creates an annotation proxy - * during xml parsing of validation mapping constraints.
+ * Description: Holds the information and creates an annotation proxy during xml + * parsing of validation mapping constraints.
*/ -//TODO move this guy up to org.apache.bval.jsr303 or org.apache.bval.jsr303.model +// TODO move this guy up to org.apache.bval.jsr303 or +// org.apache.bval.jsr303.model final public class AnnotationProxyBuilder { - //TODO extract these to some neutral location; see AnnotationConstraintBuilder + // TODO extract these to some neutral location; see + // AnnotationConstraintBuilder private static final String ANNOTATION_PAYLOAD = "payload"; private static final String ANNOTATION_GROUPS = "groups"; private static final String ANNOTATION_MESSAGE = "message"; @@ -46,6 +48,7 @@ final public class AnnotationProxyBuilde /** * Create a new AnnotationProxyBuilder instance. + * * @param annotationType */ public AnnotationProxyBuilder(Class annotationType) { @@ -54,6 +57,7 @@ final public class AnnotationProxyBuilde /** * Create a new AnnotationProxyBuilder instance. + * * @param annotationType * @param elements */ @@ -65,8 +69,9 @@ final public class AnnotationProxyBuilde } /** - * Create a builder initially configured to create an annotation equivalent to annot. - * + * Create a builder initially configured to create an annotation equivalent + * to annot. + * * @param annot * Annotation to be replicated. */ @@ -75,8 +80,8 @@ final public class AnnotationProxyBuilde this((Class) annot.annotationType()); // Obtain the "elements" of the annotation Method[] methods = SecureActions.getDeclaredMethods(annot.annotationType()); - for ( Method m : methods ) { - if ( !m.isAccessible() ) { + for (Method m : methods) { + if (!m.isAccessible()) { m.setAccessible(true); } try { @@ -95,6 +100,7 @@ final public class AnnotationProxyBuilde /** * Add an element to the configuration. + * * @param elementName * @param value */ @@ -104,6 +110,7 @@ final public class AnnotationProxyBuilde /** * Get the specified element value from the current configuration. + * * @param elementName * @return Object value */ @@ -113,8 +120,10 @@ final public class AnnotationProxyBuilde /** * Learn whether a given element has been configured. + * * @param elementName - * @return true if an elementName element is found on this annotation + * @return true if an elementName element is found + * on this annotation */ public boolean contains(String elementName) { return elements.containsKey(elementName); @@ -122,6 +131,7 @@ final public class AnnotationProxyBuilde /** * Get the number of configured elements. + * * @return int */ public int size() { @@ -130,6 +140,7 @@ final public class AnnotationProxyBuilde /** * Get the configured Annotation type. + * * @return Class */ public Class getType() { @@ -138,6 +149,7 @@ final public class AnnotationProxyBuilde /** * Configure the well-known JSR303 "message" element. + * * @param message */ public void setMessage(String message) { @@ -146,6 +158,7 @@ final public class AnnotationProxyBuilde /** * Configure the well-known JSR303 "groups" element. + * * @param groups */ public void setGroups(Class[] groups) { @@ -154,6 +167,7 @@ final public class AnnotationProxyBuilde /** * Configure the well-known JSR303 "payload" element. + * * @param payload */ public void setPayload(Class[] payload) { @@ -162,6 +176,7 @@ final public class AnnotationProxyBuilde /** * Create the annotation represented by this builder. + * * @return {@link Annotation} */ @SuppressWarnings("unchecked") @@ -170,13 +185,11 @@ final public class AnnotationProxyBuilde Class proxyClass = (Class) Proxy.getProxyClass(classLoader, getType()); InvocationHandler handler = new AnnotationProxy(this); try { - return SecureActions.getConstructor(proxyClass, InvocationHandler.class) - .newInstance(handler); + return SecureActions.getConstructor(proxyClass, InvocationHandler.class).newInstance(handler); } catch (ValidationException e) { throw e; } catch (Exception e) { - throw new ValidationException( - "Unable to create annotation for configured constraint", e); + throw new ValidationException("Unable to create annotation for configured constraint", e); } } }