net.sf.mmm.util.reflect.base
Class AnnotationFilter

java.lang.Object
  extended by net.sf.mmm.util.reflect.base.AnnotationFilter
All Implemented Interfaces:
Filter<Class<?>>

public class AnnotationFilter
extends Object
implements Filter<Class<?>>

This is a filter that only accepts types that are annotated with an annotation given at construction.

Since:
1.0.1
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
private  Class<? extends Annotation> annotationType
          The required annotation.
private  AnnotationUtilImpl annotationUtil
          The AnnotationUtilImpl to use.
private  boolean forceInheritence
          If true then also types are accepted if one of their super-types (including implemented interfaces) is properly annotated (see AnnotationUtilImpl.getTypeAnnotation(Class, Class)).
 
Constructor Summary
AnnotationFilter(Class<? extends Annotation> annotationType)
          The constructor.
AnnotationFilter(Class<? extends Annotation> annotationType, boolean forceInheritence)
          The constructor.
AnnotationFilter(Class<? extends Annotation> annotationType, boolean forceInheritence, AnnotationUtilImpl annotationUtil)
          The constructor.
 
Method Summary
 boolean accept(Class<?> type)
          This method determines if the given value should be accepted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

annotationUtil

private AnnotationUtilImpl annotationUtil
The AnnotationUtilImpl to use.


annotationType

private final Class<? extends Annotation> annotationType
The required annotation.


forceInheritence

private final boolean forceInheritence
If true then also types are accepted if one of their super-types (including implemented interfaces) is properly annotated (see AnnotationUtilImpl.getTypeAnnotation(Class, Class)).

Constructor Detail

AnnotationFilter

public AnnotationFilter(Class<? extends Annotation> annotationType)
                 throws IllegalArgumentException
The constructor.

Parameters:
annotationType - is the annotation that has to be present if a type should be accepted.
Throws:
IllegalArgumentException - if the given annotationType is NO runtime annotation.

AnnotationFilter

public AnnotationFilter(Class<? extends Annotation> annotationType,
                        boolean forceInheritence)
                 throws IllegalArgumentException
The constructor.

Parameters:
annotationType - is the annotation that has to be present if a type should be accepted.
forceInheritence - if true then also types are accepted if one of their super-types (including implemented interfaces) is properly annotated (see AnnotationUtilImpl.getTypeAnnotation(Class, Class)).
Throws:
IllegalArgumentException - if the given annotationType is NO runtime annotation.

AnnotationFilter

public AnnotationFilter(Class<? extends Annotation> annotationType,
                        boolean forceInheritence,
                        AnnotationUtilImpl annotationUtil)
                 throws IllegalArgumentException
The constructor.

Parameters:
annotationType - is the annotation that has to be present if a type should be accepted.
forceInheritence - if true then also types are accepted if one of their super-types (including implemented interfaces) is properly annotated (see AnnotationUtilImpl.getTypeAnnotation(Class, Class)).
annotationUtil - is the AnnotationUtilImpl instance to use.
Throws:
IllegalArgumentException - if the given annotationType is NO runtime annotation.
Method Detail

accept

public boolean accept(Class<?> type)
This method determines if the given value should be accepted.

Specified by:
accept in interface Filter<Class<?>>
Parameters:
type - is the value to check.
Returns:
true if the specified annotation is present for the given type, false otherwise.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.