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/11/20 20:23:23 UTC
svn commit: r1204218 - in /commons/sandbox/meiyo/trunk/src:
main/java/org/apache/commons/meiyo/classpath/
main/java/org/apache/commons/meiyo/classpath/filter/
test/java/org/apache/commons/meiyo/classpath/
test/java/org/apache/commons/meiyo/classpath/fi...
Author: simonetripodi
Date: Sun Nov 20 19:23:22 2011
New Revision: 1204218
URL: http://svn.apache.org/viewvc?rev=1204218&view=rev
Log:
filters language moved directly under the configuration class, so users don't have to get crazy importing static methods - reduces useless verbosity in import statements and allows direct access to the filter language
Removed:
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/AbstractHandlerConfiguration.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/And.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/AnnotatedWith.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/AnnotatedWithType.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Any.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/ClassNameMatches.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/ContainsMethod.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/InPackage.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/InSubpackage.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsAbstract.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsAnnotation.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsAnonymousClass.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsAssignableTo.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsEnum.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsFinal.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsInterface.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsPrivate.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsPublic.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsStatic.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsStrict.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Not.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Or.java
commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Xor.java
commons/sandbox/meiyo/trunk/src/test/java/org/apache/commons/meiyo/classpath/ClassPathTestCase.java
commons/sandbox/meiyo/trunk/src/test/java/org/apache/commons/meiyo/classpath/filter/FiltersTestCase.java
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/AbstractHandlerConfiguration.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/AbstractHandlerConfiguration.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/AbstractHandlerConfiguration.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/AbstractHandlerConfiguration.java Sun Nov 20 19:23:22 2011
@@ -19,10 +19,32 @@ package org.apache.commons.meiyo.classpa
* under the License.
*/
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.util.Collection;
import java.util.LinkedList;
+import org.apache.commons.meiyo.classpath.filter.AnnotatedWith;
+import org.apache.commons.meiyo.classpath.filter.AnnotatedWithType;
+import org.apache.commons.meiyo.classpath.filter.Any;
+import org.apache.commons.meiyo.classpath.filter.ClassNameMatches;
+import org.apache.commons.meiyo.classpath.filter.ContainsMethod;
import org.apache.commons.meiyo.classpath.filter.Filter;
+import org.apache.commons.meiyo.classpath.filter.InPackage;
+import org.apache.commons.meiyo.classpath.filter.InSubpackage;
+import org.apache.commons.meiyo.classpath.filter.IsAbstract;
+import org.apache.commons.meiyo.classpath.filter.IsAnnotation;
+import org.apache.commons.meiyo.classpath.filter.IsAnonymousClass;
+import org.apache.commons.meiyo.classpath.filter.IsAssignableTo;
+import org.apache.commons.meiyo.classpath.filter.IsEnum;
+import org.apache.commons.meiyo.classpath.filter.IsFinal;
+import org.apache.commons.meiyo.classpath.filter.IsInterface;
+import org.apache.commons.meiyo.classpath.filter.IsPrivate;
+import org.apache.commons.meiyo.classpath.filter.IsPublic;
+import org.apache.commons.meiyo.classpath.filter.IsStatic;
+import org.apache.commons.meiyo.classpath.filter.IsStrict;
+import org.apache.commons.meiyo.classpath.filter.Not;
/**
* A support class for {@link HandlerConfiguration} which reduces repetition and results
@@ -67,6 +89,279 @@ public abstract class AbstractHandlerCon
}
/**
+ * 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.
+ */
+ protected final Filter annotatedWith( Annotation annotation )
+ {
+ if ( annotation == null )
+ {
+ throw new IllegalArgumentException( "Parameter 'annotation' must not be null" );
+ }
+
+ checkForRuntimeRetention( annotation.annotationType() );
+
+ 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.
+ */
+ protected final Filter annotatedWithType( Class<? extends Annotation> annotationType )
+ {
+ if ( annotationType == null )
+ {
+ throw new IllegalArgumentException( "Parameter 'annotationType' must not be null" );
+ }
+
+ checkForRuntimeRetention( annotationType );
+
+ 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 );
+ if ( retention == null || RetentionPolicy.RUNTIME != retention.value() )
+ {
+ throw new IllegalArgumentException( "Annotation @" + annotationType.getName()
+ + " is missing RUNTIME retention" );
+ }
+ }
+
+ /**
+ * Creates a new {@code Filter} that doesn't apply any check for every Class found in the ClassPath.
+ *
+ * @return a new {@code Filter} instance.
+ */
+ protected final 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.
+ */
+ protected final Filter classNameMatches( String regex )
+ {
+ if ( regex == null )
+ {
+ throw new IllegalArgumentException( "Parameter 'regex' must not be null" );
+ }
+ if ( regex.length() == 0 )
+ {
+ throw new IllegalArgumentException( "Empty 'regex' not allowed" );
+ }
+
+ return new ClassNameMatches( 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.
+ */
+ protected final Filter containsMethod( String name, Class<?>... argumentsType )
+ {
+ if ( name == null )
+ {
+ throw new IllegalArgumentException( "Parameter 'name' must not be null" );
+ }
+
+ 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.
+ */
+ protected final Filter inPackage( String targetPackage )
+ {
+ if ( targetPackage == null )
+ {
+ throw new IllegalArgumentException( "Parameter 'targetPackage' must be not null" );
+ }
+
+ 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.
+ */
+ protected final Filter inSubpackage( String targetPackage )
+ {
+ if ( targetPackage == null )
+ {
+ throw new IllegalArgumentException( "Parameter 'targetPackage' must be not null" );
+ }
+
+ 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.
+ */
+ protected final Filter isAbstract()
+ {
+ return new IsAbstract();
+ }
+
+ /**
+ * Creates a new {@code Filter} that checks the Class found in the ClassPath is an {@link Annotation} class.
+ *
+ * @return a new {@code Filter} instance.
+ */
+ protected final Filter isAnnotation()
+ {
+ return new IsAnnotation();
+ }
+
+ /**
+ * Creates a new {@code Filter} that checks the Class found in the ClassPath is an anonymous class.
+ *
+ * @return a new {@code Filter} instance.
+ */
+ protected final Filter isAnonymous()
+ {
+ return new IsAnonymousClass();
+ }
+
+ /**
+ * 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.
+ */
+ protected final Filter isAssignableTo( Class<?> superclassOrInterface )
+ {
+ if ( superclassOrInterface == null )
+ {
+ throw new IllegalArgumentException( "Parameter 'superclassOrInterface' must be not null" );
+ }
+
+ return new IsAssignableTo( superclassOrInterface );
+ }
+
+ /**
+ * Creates a new {@code Filter} that checks the Class found in the ClassPath is an Enumeration.
+ *
+ * @return a new {@code Filter} instance.
+ */
+ protected final Filter isEnum()
+ {
+ return new IsEnum();
+ }
+
+ /**
+ * Creates a new {@code Filter} that checks the Class found in the ClassPath is a final Class.
+ *
+ * @return a new {@code Filter} instance.
+ */
+ protected final 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.
+ */
+ protected final 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.
+ */
+ protected final 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.
+ */
+ protected final 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.
+ */
+ protected final 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.
+ */
+ protected final 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.
+ */
+ protected final Filter not( Filter delegate )
+ {
+ if ( delegate == null )
+ {
+ throw new IllegalArgumentException( "Parameter 'delegate' must be not null" );
+ }
+
+ return new Not( delegate );
+ }
+
+ /**
* Returns the configured {@link ClassPathHandler}s storage.
*
* @return the configured {@link ClassPathHandler}s storage.
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/And.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/And.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/And.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/And.java Sun Nov 20 19:23:22 2011
@@ -22,7 +22,7 @@ package org.apache.commons.meiyo.classpa
/**
* Implementation of the logic AND between filters, return true if all the given filters return true.
*/
-final class And
+public final class And
extends AbstractFilter
{
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/AnnotatedWith.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/AnnotatedWith.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/AnnotatedWith.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/AnnotatedWith.java Sun Nov 20 19:23:22 2011
@@ -24,7 +24,7 @@ import java.lang.annotation.Annotation;
/**
* A filter that verifies the class found is annotated with the given annotation.
*/
-final class AnnotatedWith
+public final class AnnotatedWith
extends AbstractFilter
{
@@ -35,7 +35,7 @@ final class AnnotatedWith
/**
* Crates a new annotation filter.
- *
+ *
* @param annotation the annotation has to be searched on classes.
*/
public AnnotatedWith( Annotation annotation )
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/AnnotatedWithType.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/AnnotatedWithType.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/AnnotatedWithType.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/AnnotatedWithType.java Sun Nov 20 19:23:22 2011
@@ -24,7 +24,7 @@ import java.lang.annotation.Annotation;
/**
* A filter that verifies the given annotation type is present on the class found.
*/
-final class AnnotatedWithType
+public final class AnnotatedWithType
extends AbstractFilter
{
@@ -35,7 +35,7 @@ final class AnnotatedWithType
/**
* Creates a new annotation type matcher filter.
- *
+ *
* @param annotationType the annotation type has to be present on the class found.
*/
public AnnotatedWithType( Class<? extends Annotation> annotationType )
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Any.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Any.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Any.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Any.java Sun Nov 20 19:23:22 2011
@@ -22,7 +22,7 @@ package org.apache.commons.meiyo.classpa
/**
* A filter that returns true for any class found.
*/
-final class Any
+public final class Any
extends AbstractFilter
{
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/ClassNameMatches.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/ClassNameMatches.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/ClassNameMatches.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/ClassNameMatches.java Sun Nov 20 19:23:22 2011
@@ -24,7 +24,7 @@ import java.util.regex.Pattern;
/**
* A filter that verifies the class found name matches against a given pattern.
*/
-final class ClassNameMatches
+public final class ClassNameMatches
extends AbstractFilter
{
@@ -35,7 +35,7 @@ final class ClassNameMatches
/**
* Creates a new class name matcher.
- *
+ *
* @param regex the class name regexp pattern has to be matched.
*/
public ClassNameMatches( String regex )
@@ -45,7 +45,7 @@ final class ClassNameMatches
/**
* Creates a new class name matcher.
- *
+ *
* @param pattern the class name pattern has to be matched.
*/
public ClassNameMatches( Pattern pattern )
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/ContainsMethod.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/ContainsMethod.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/ContainsMethod.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/ContainsMethod.java Sun Nov 20 19:23:22 2011
@@ -28,7 +28,7 @@ import java.util.Arrays;
/**
* A filter that verifies the class found contains a method with the given signature.
*/
-final class ContainsMethod
+public final class ContainsMethod
extends AbstractFilter
{
@@ -44,7 +44,7 @@ final class ContainsMethod
/**
* Creates a new {@code ContainsMethod} instance.
- *
+ *
* @param name the method name has to be contained in the class found.
* @param argumentsType the optional method arguments type.
*/
@@ -77,7 +77,7 @@ final class ContainsMethod
/**
* Returns all the declared methods in the given class, using the privileged access.
- *
+ *
* @param type the class from which extract the declared methods.
* @return the declared methods array.
*/
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/InPackage.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/InPackage.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/InPackage.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/InPackage.java Sun Nov 20 19:23:22 2011
@@ -22,7 +22,7 @@ package org.apache.commons.meiyo.classpa
/**
* Filter that verifies the found class is exactly in the given package.
*/
-final class InPackage
+public final class InPackage
extends AbstractFilter
{
@@ -33,7 +33,7 @@ final class InPackage
/**
* Creates a new package based filter.
- *
+ *
* @param targetPackage the package where classes are looked for.
*/
public InPackage( String targetPackage )
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/InSubpackage.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/InSubpackage.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/InSubpackage.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/InSubpackage.java Sun Nov 20 19:23:22 2011
@@ -22,7 +22,7 @@ package org.apache.commons.meiyo.classpa
/**
* Filter that verifies the found class is in the given package or subpackage.
*/
-final class InSubpackage
+public final class InSubpackage
extends AbstractFilter
{
@@ -33,7 +33,7 @@ final class InSubpackage
/**
* Creates a new (sub)package based filter.
- *
+ *
* @param targetPackageName the package where classes are looked for.
*/
public InSubpackage( String targetPackageName )
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsAbstract.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsAbstract.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsAbstract.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsAbstract.java Sun Nov 20 19:23:22 2011
@@ -22,9 +22,9 @@ package org.apache.commons.meiyo.classpa
import java.lang.reflect.Modifier;
/**
- *
+ *
*/
-final class IsAbstract
+public final class IsAbstract
extends AbstractFilter
{
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsAnnotation.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsAnnotation.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsAnnotation.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsAnnotation.java Sun Nov 20 19:23:22 2011
@@ -22,7 +22,7 @@ package org.apache.commons.meiyo.classpa
/**
*
*/
-final class IsAnnotation
+public final class IsAnnotation
extends AbstractFilter
{
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsAnonymousClass.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsAnonymousClass.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsAnonymousClass.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsAnonymousClass.java Sun Nov 20 19:23:22 2011
@@ -22,7 +22,7 @@ package org.apache.commons.meiyo.classpa
/**
* A filter that verifies the Class found is anonymous.
*/
-final class IsAnonymousClass
+public final class IsAnonymousClass
extends AbstractFilter
{
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsAssignableTo.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsAssignableTo.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsAssignableTo.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsAssignableTo.java Sun Nov 20 19:23:22 2011
@@ -22,7 +22,7 @@ package org.apache.commons.meiyo.classpa
/**
*
*/
-final class IsAssignableTo
+public final class IsAssignableTo
extends AbstractFilter
{
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsEnum.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsEnum.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsEnum.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsEnum.java Sun Nov 20 19:23:22 2011
@@ -22,7 +22,7 @@ package org.apache.commons.meiyo.classpa
/**
* A filter that verifies the Class found is an Enumeration.
*/
-final class IsEnum
+public final class IsEnum
extends AbstractFilter
{
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsFinal.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsFinal.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsFinal.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsFinal.java Sun Nov 20 19:23:22 2011
@@ -22,9 +22,9 @@ package org.apache.commons.meiyo.classpa
import java.lang.reflect.Modifier;
/**
- *
+ *
*/
-final class IsFinal
+public final class IsFinal
extends AbstractFilter
{
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsInterface.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsInterface.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsInterface.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsInterface.java Sun Nov 20 19:23:22 2011
@@ -22,9 +22,9 @@ package org.apache.commons.meiyo.classpa
import java.lang.reflect.Modifier;
/**
- *
+ *
*/
-final class IsInterface
+public final class IsInterface
extends AbstractFilter
{
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsPrivate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsPrivate.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsPrivate.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsPrivate.java Sun Nov 20 19:23:22 2011
@@ -22,9 +22,9 @@ package org.apache.commons.meiyo.classpa
import java.lang.reflect.Modifier;
/**
- *
+ *
*/
-final class IsPrivate
+public final class IsPrivate
extends AbstractFilter
{
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsPublic.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsPublic.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsPublic.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsPublic.java Sun Nov 20 19:23:22 2011
@@ -22,9 +22,9 @@ package org.apache.commons.meiyo.classpa
import java.lang.reflect.Modifier;
/**
- *
+ *
*/
-final class IsPublic
+public final class IsPublic
extends AbstractFilter
{
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsStatic.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsStatic.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsStatic.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsStatic.java Sun Nov 20 19:23:22 2011
@@ -22,9 +22,9 @@ package org.apache.commons.meiyo.classpa
import java.lang.reflect.Modifier;
/**
- *
+ *
*/
-final class IsStatic
+public final class IsStatic
extends AbstractFilter
{
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsStrict.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsStrict.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsStrict.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/IsStrict.java Sun Nov 20 19:23:22 2011
@@ -22,9 +22,9 @@ package org.apache.commons.meiyo.classpa
import java.lang.reflect.Modifier;
/**
- *
+ *
*/
-final class IsStrict
+public final class IsStrict
extends AbstractFilter
{
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Not.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Not.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Not.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Not.java Sun Nov 20 19:23:22 2011
@@ -22,7 +22,7 @@ package org.apache.commons.meiyo.classpa
/**
*
*/
-final class Not
+public final class Not
extends AbstractFilter
{
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Or.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Or.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Or.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Or.java Sun Nov 20 19:23:22 2011
@@ -22,7 +22,7 @@ package org.apache.commons.meiyo.classpa
/**
*
*/
-class Or
+public class Or
extends AbstractFilter
{
Modified: commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Xor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Xor.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Xor.java (original)
+++ commons/sandbox/meiyo/trunk/src/main/java/org/apache/commons/meiyo/classpath/filter/Xor.java Sun Nov 20 19:23:22 2011
@@ -22,7 +22,7 @@ package org.apache.commons.meiyo.classpa
/**
*
*/
-final class Xor
+public final class Xor
extends AbstractFilter
{
Modified: commons/sandbox/meiyo/trunk/src/test/java/org/apache/commons/meiyo/classpath/ClassPathTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/test/java/org/apache/commons/meiyo/classpath/ClassPathTestCase.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/test/java/org/apache/commons/meiyo/classpath/ClassPathTestCase.java (original)
+++ commons/sandbox/meiyo/trunk/src/test/java/org/apache/commons/meiyo/classpath/ClassPathTestCase.java Sun Nov 20 19:23:22 2011
@@ -20,13 +20,6 @@ package org.apache.commons.meiyo.classpa
*/
import static org.apache.commons.meiyo.classpath.ClassPathScanner.createClassPathFromJVM;
-import static org.apache.commons.meiyo.classpath.filter.Filters.any;
-import static org.apache.commons.meiyo.classpath.filter.Filters.classNameMatches;
-import static org.apache.commons.meiyo.classpath.filter.Filters.inSubpackage;
-import static org.apache.commons.meiyo.classpath.filter.Filters.isAbstract;
-import static org.apache.commons.meiyo.classpath.filter.Filters.isAnnotation;
-import static org.apache.commons.meiyo.classpath.filter.Filters.isPublic;
-import static org.apache.commons.meiyo.classpath.filter.Filters.not;
import java.util.ArrayList;
import java.util.List;
Modified: commons/sandbox/meiyo/trunk/src/test/java/org/apache/commons/meiyo/classpath/filter/FiltersTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/meiyo/trunk/src/test/java/org/apache/commons/meiyo/classpath/filter/FiltersTestCase.java?rev=1204218&r1=1204217&r2=1204218&view=diff
==============================================================================
--- commons/sandbox/meiyo/trunk/src/test/java/org/apache/commons/meiyo/classpath/filter/FiltersTestCase.java (original)
+++ commons/sandbox/meiyo/trunk/src/test/java/org/apache/commons/meiyo/classpath/filter/FiltersTestCase.java Sun Nov 20 19:23:22 2011
@@ -19,13 +19,6 @@ package org.apache.commons.meiyo.classpa
* under the License.
*/
-import static org.apache.commons.meiyo.classpath.filter.Filters.annotatedWithType;
-import static org.apache.commons.meiyo.classpath.filter.Filters.containsMethod;
-import static org.apache.commons.meiyo.classpath.filter.Filters.inPackage;
-import static org.apache.commons.meiyo.classpath.filter.Filters.inSubpackage;
-import static org.apache.commons.meiyo.classpath.filter.Filters.isAbstract;
-import static org.apache.commons.meiyo.classpath.filter.Filters.isInterface;
-
import java.util.List;
import org.apache.commons.meiyo.classpath.ClassLoaderBuilder;
@@ -43,20 +36,14 @@ public final class FiltersTestCase
@Test
public void matchesAnnotatedWithType()
{
- assert annotatedWithType( DummyAnnotation.class ).matches( this.getClass() );
- assert !annotatedWithType( RunWith.class ).matches( this.getClass() );
- }
-
- @Test( expected = IllegalArgumentException.class )
- public void noRuntimeRetention()
- {
- annotatedWithType( NoRuntimeRetention.class );
+ assert new AnnotatedWithType( DummyAnnotation.class ).matches( this.getClass() );
+ assert !new AnnotatedWithType( RunWith.class ).matches( this.getClass() );
}
@Test
public void matchesInPackage()
{
- Filter inMeiyoPackage = inPackage( "org.apache.commons.meiyo.classpath" );
+ Filter inMeiyoPackage = new InPackage( "org.apache.commons.meiyo.classpath" );
assert inMeiyoPackage.matches( ClassPathScanner.class );
assert !inMeiyoPackage.matches( List.class );
}
@@ -64,15 +51,15 @@ public final class FiltersTestCase
@Test
public void matchesInSubPackage()
{
- Filter inMeiyoPackage = inSubpackage( "org.apache.commons.meiyo.classpath" );
- assert inMeiyoPackage.matches( Filters.class );
+ Filter inMeiyoPackage = new InSubpackage( "org.apache.commons.meiyo.classpath" );
+ assert inMeiyoPackage.matches( InSubpackage.class );
assert !inMeiyoPackage.matches( List.class );
}
@Test
public void matchesInterface()
{
- Filter isInterface = isInterface();
+ Filter isInterface = new IsInterface();
assert !isInterface.matches( DummyAnnotation.class );
assert isInterface.matches( DummyInterface.class );
}
@@ -80,7 +67,7 @@ public final class FiltersTestCase
@Test
public void matchesAbstract()
{
- Filter isAbstract = isAbstract();
+ Filter isAbstract = new IsAbstract();
assert isAbstract.matches( AbstractFilter.class );
assert !isAbstract.matches( Filter.class );
}
@@ -88,7 +75,7 @@ public final class FiltersTestCase
@Test
public void matchesContainsMethodWithNoArguments()
{
- Filter containsMethod = containsMethod( "usingContextClassLoader" );
+ Filter containsMethod = new ContainsMethod( "usingContextClassLoader" );
assert containsMethod.matches( ClassLoaderBuilder.class );
assert !containsMethod.matches( Filter.class );
}
@@ -96,7 +83,7 @@ public final class FiltersTestCase
@Test
public void matchesContainsMethodWithArguments()
{
- Filter containsMethod = containsMethod( "matches", Class.class );
+ Filter containsMethod = new ContainsMethod( "matches", Class.class );
assert containsMethod.matches( Filter.class );
assert !containsMethod.matches( ClassPathScanner.class );
}