You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2011/06/14 15:41:33 UTC

svn commit: r1135566 - /commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classvisitor/ClassVisitor.java

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<VisitorConfiguration> 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 <AE> Any {@link AnnotatedElement} type.
+     * @param action The {@link PrivilegedAction} that's able to extract {@link AnnotatedElement}s.
+     */
     private <AE extends AnnotatedElement> void visitElements( PrivilegedAction<AE[]> 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 )