Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-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 1CEA26EED for ; Tue, 14 Jun 2011 13:41:55 +0000 (UTC) Received: (qmail 4763 invoked by uid 500); 14 Jun 2011 13:41:54 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 4707 invoked by uid 500); 14 Jun 2011 13:41:54 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 4698 invoked by uid 99); 14 Jun 2011 13:41:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Jun 2011 13:41:54 +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; Tue, 14 Jun 2011 13:41:53 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 7D8E223889E0; Tue, 14 Jun 2011 13:41:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1135566 - /commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classvisitor/ClassVisitor.java Date: Tue, 14 Jun 2011 13:41:33 -0000 To: commits@commons.apache.org From: simonetripodi@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110614134133.7D8E223889E0@eris.apache.org> Author: simonetripodi Date: Tue Jun 14 13:41:33 2011 New Revision: 1135566 URL: http://svn.apache.org/viewvc?rev=1135566&view=rev Log: filled missing javadoc Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classvisitor/ClassVisitor.java Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classvisitor/ClassVisitor.java URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classvisitor/ClassVisitor.java?rev=1135566&r1=1135565&r2=1135566&view=diff ============================================================================== --- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classvisitor/ClassVisitor.java (original) +++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classvisitor/ClassVisitor.java Tue Jun 14 13:41:33 2011 @@ -29,9 +29,18 @@ import java.security.PrivilegedAction; import java.util.Arrays; import java.util.Collection; +/** + * A {@code ClassVisitor} traverses input classes for the whole hierarchy, and for every annotated element member + */ public final class ClassVisitor { + /** + * Initialize the Class visitor given one or more configuration. + * + * @param configurations the configurations needed to set-up the visitor. + * @return a new {@code ClassVisitor} instance. + */ public static ClassVisitor createVisitor( VisitorConfiguration... configurations ) { if ( configurations == null || configurations.length == 0 ) @@ -41,6 +50,12 @@ public final class ClassVisitor return createVisitor( Arrays.asList( configurations ) ); } + /** + * Initialize the Class visitor given a collection of configurations. + * + * @param configurations the configurations needed to set-up the visitor. + * @return a new {@code ClassVisitor} instance. + */ public static ClassVisitor createVisitor( Collection configurations ) { if ( configurations == null || configurations.isEmpty() ) @@ -61,11 +76,22 @@ public final class ClassVisitor private final AnnotationHandlerBinderImpl binder; + /** + * Creates a new Class visitor given the configured binder. + * + * @param binder an already configured binder. + */ private ClassVisitor( final AnnotationHandlerBinderImpl binder ) { this.binder = binder; } + /** + * Visit the input Class and invokes {@link AnnotationHandler}s every time they match against + * the annotated elements/annotations. + * + * @param type The Class has to be visited. + */ public void visit( final Class type ) { if ( type == null || type.getPackage().getName().startsWith( JAVA_PACKAGE ) ) @@ -109,6 +135,12 @@ public final class ClassVisitor visit( type.getSuperclass() ); } + /** + * Executes the given {@link PrivilegedAction} that extracts {@link AnnotatedElement}s. + * + * @param Any {@link AnnotatedElement} type. + * @param action The {@link PrivilegedAction} that's able to extract {@link AnnotatedElement}s. + */ private void visitElements( PrivilegedAction action ) { AE[] annotatedElements = null; @@ -123,6 +155,11 @@ public final class ClassVisitor visitElements( annotatedElements ); } + /** + * Invokes {@link AnnotationHandler}s that matches the visited {@link AnnotatedElement}/{@link Annotation}. + * + * @param annotatedElements the {@code AnnotatedElement} has to be visited. + */ private void visitElements( AnnotatedElement... annotatedElements ) { for ( AnnotatedElement element : annotatedElements )