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 14:10:14 UTC
svn commit: r1135513 -
/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Filters.java
Author: simonetripodi
Date: Tue Jun 14 12:10:13 2011
New Revision: 1135513
URL: http://svn.apache.org/viewvc?rev=1135513&view=rev
Log:
filled missing javadoc
Modified:
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Filters.java
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Filters.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Filters.java?rev=1135513&r1=1135512&r2=1135513&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Filters.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Filters.java Tue Jun 14 12:10:13 2011
@@ -37,6 +37,15 @@ public final class Filters
// do nothing
}
+ /**
+ * Creates a new {@code Filter} that checks a Class found in the ClassPath is annotated with the input annotation.
+ *
+ * <b>NOTE</b>: the input {@link Annotation} retention has to be equals to
+ * {@code java.lang.annotation.RetentionPolicy} otherwise the check cannot be performed.
+ *
+ * @param annotation The {@code Annotation} has to be searched in the Classes found in the ClassPath
+ * @return a new {@code Filter} instance.
+ */
public static Filter annotatedWith( Annotation annotation )
{
if ( annotation == null )
@@ -49,6 +58,16 @@ public final class Filters
return new AnnotatedWith( annotation );
}
+ /**
+ * Creates a new {@code Filter} that checks a Class found in the ClassPath is annotated with the input
+ * annotation type.
+ *
+ * <b>NOTE</b>: the input {@link Annotation} type retention has to be equals to
+ * {@code java.lang.annotation.RetentionPolicy} otherwise the check cannot be performed.
+ *
+ * @param annotationType The {@code Annotation} type has to be searched in the Classes found in the ClassPath
+ * @return a new {@code Filter} instance.
+ */
public static Filter annotatedWithType( Class<? extends Annotation> annotationType )
{
if ( annotationType == null )
@@ -61,6 +80,11 @@ public final class Filters
return new AnnotatedWithType( annotationType );
}
+ /**
+ * Simply verifies the input {@link Annotation} type retention is {@code java.lang.annotation.RetentionPolicy}.
+ *
+ * @param annotationType the {@link Annotation} type retention has to be checked.
+ */
private static void checkForRuntimeRetention( Class<? extends Annotation> annotationType )
{
Retention retention = annotationType.getAnnotation( Retention.class );
@@ -71,11 +95,23 @@ public final class Filters
}
}
+ /**
+ * Creates a new {@code Filter} that doesn't apply any check for every Class found in the ClassPath.
+ *
+ * @return a new {@code Filter} instance.
+ */
public static Filter any()
{
return new Any();
}
+ /**
+ * Creates a new {@code Filter} that checks the simple Class name matches against
+ * the input Regular Expression pattern.
+ *
+ * @param regex The regular expression used to match the Class simple name.
+ * @return a new {@code Filter} instance.
+ */
public static Filter classNameMatches( String regex )
{
if ( regex == null )
@@ -90,6 +126,14 @@ public final class Filters
return new ClassNameMatchesFilter( regex );
}
+ /**
+ * Creates a new {@code Filter} that checks the Class found in the ClassPath contains the method with the
+ * given name and arguments type.
+ *
+ * @param name The method name has to be looked for in the Classes found in the ClassPath
+ * @param argumentsType The method arguments type
+ * @return a new {@code Filter} instance.
+ */
public static Filter containsMethod( String name, Class<?>... argumentsType )
{
if ( name == null )
@@ -100,6 +144,12 @@ public final class Filters
return new ContainsMethod( name, argumentsType );
}
+ /**
+ * Creates a new {@code Filter} that checks the Class found in the ClassPath is in exactly the given package.
+ *
+ * @param targetPackage The package which Classes found in the ClassPath have to be contained in.
+ * @return a new {@code Filter} instance.
+ */
public static Filter inPackage( String targetPackage )
{
if ( targetPackage == null )
@@ -110,6 +160,13 @@ public final class Filters
return new InPackage( targetPackage );
}
+ /**
+ * Creates a new {@code Filter} that checks the Class found in the ClassPath is in the given package or in one
+ * subpackage.
+ *
+ * @param targetPackage The parent package which Classes found in the ClassPath have to be contained in.
+ * @return a new {@code Filter} instance.
+ */
public static Filter inSubpackage( String targetPackage )
{
if ( targetPackage == null )
@@ -120,6 +177,11 @@ public final class Filters
return new InSubpackage( targetPackage );
}
+ /**
+ * Creates a new {@code Filter} that checks the Class found in the ClassPath is an abstract class.
+ *
+ * @return a new {@code Filter} instance.
+ */
public static Filter isAbstract()
{
return new IsAbstract();
@@ -130,6 +192,13 @@ public final class Filters
return new IsAnnotation();
}
+ /**
+ * Creates a new {@code Filter} that checks the Class found in the ClassPath inherits the given Class
+ * or implements the given Interface.
+ *
+ * @param superclassOrInterface The super Class or Interface
+ * @return a new {@code Filter} instance.
+ */
public static Filter isAssignableTo( Class<?> superclassOrInterface )
{
if ( superclassOrInterface == null )
@@ -140,36 +209,72 @@ public final class Filters
return new IsAssignableTo( superclassOrInterface );
}
+ /**
+ * Creates a new {@code Filter} that checks the Class found in the ClassPath is a final Class.
+ *
+ * @return a new {@code Filter} instance.
+ */
public static Filter isFinal()
{
return new IsFinal();
}
+ /**
+ * Creates a new {@code Filter} that checks the Class found in the ClassPath is an Interface.
+ *
+ * @return a new {@code Filter} instance.
+ */
public static Filter isInterface()
{
return new IsInterface();
}
+ /**
+ * Creates a new {@code Filter} that checks the Class found in the ClassPath is private.
+ *
+ * @return a new {@code Filter} instance.
+ */
public static Filter isPrivate()
{
return new IsPrivate();
}
+ /**
+ * Creates a new {@code Filter} that checks the Class found in the ClassPath is public.
+ *
+ * @return a new {@code Filter} instance.
+ */
public static Filter isPublic()
{
return new IsPublic();
}
+ /**
+ * Creates a new {@code Filter} that checks the Class found in the ClassPath is static.
+ *
+ * @return a new {@code Filter} instance.
+ */
public static Filter isStatic()
{
return new IsStatic();
}
+ /**
+ * Creates a new {@code Filter} that checks the Class found in the ClassPath is strict.
+ *
+ * @return a new {@code Filter} instance.
+ */
public static Filter isStrict()
{
return new IsStrict();
}
+ /**
+ * Creates a new {@code Filter} that implements the logical negation of the input Filter.
+ *
+ * @param delegate the Filter has to be negated.
+ * @return a new {@code Filter} instance.
+ */
public static Filter not( Filter delegate )
{
if ( delegate == null )