Package net.sf.basedb.core.snapshot
Class DisabledInheritanceFilter
- java.lang.Object
-
- net.sf.basedb.core.snapshot.DisabledInheritanceFilter
-
- All Implemented Interfaces:
Filter<AnnotationSnapshot>
public class DisabledInheritanceFilter extends Object implements Filter<AnnotationSnapshot>
Filter implementation that filters away annotations that have an annotation type with inheritance disabled. A parent filter may be specified withsetParentFilter(Filter)
which is checked before checking the annotation type. This filter will only accept an annotatin if the parent filter accepts it and if the annotation type allows inheritance.- Since:
- 3.5
- Author:
- Nicklas
-
-
Constructor Summary
Constructors Constructor Description DisabledInheritanceFilter(DbControl dc)
Create a new filter.DisabledInheritanceFilter(DisabledInheritanceFilter other)
Create a clone of another filter instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
evaluate(AnnotationSnapshot snapshot)
Evaluate if the given object should pass the filter or not.void
setParentFilter(Filter<? super AnnotationSnapshot> parent)
Set a parent filter that must also be passed in order for the this filter to pass an annotation.
-
-
-
Field Detail
-
parent
private Filter<? super AnnotationSnapshot> parent
-
-
Constructor Detail
-
DisabledInheritanceFilter
public DisabledInheritanceFilter(DbControl dc)
Create a new filter. It will load all current annotation types with disabled inheritance and store internally.
-
DisabledInheritanceFilter
public DisabledInheritanceFilter(DisabledInheritanceFilter other)
Create a clone of another filter instance. Use this method to re-use the loaded annotation types when there is a risk of thread issues by using the root filter together with thesetParentFilter(Filter)
method.
-
-
Method Detail
-
evaluate
public boolean evaluate(AnnotationSnapshot snapshot)
Description copied from interface:Filter
Evaluate if the given object should pass the filter or not.- Specified by:
evaluate
in interfaceFilter<AnnotationSnapshot>
- Parameters:
snapshot
- The object to evaluate- Returns:
- TRUE if the object passes the filter, FALSE otherwise
-
setParentFilter
public void setParentFilter(Filter<? super AnnotationSnapshot> parent)
Set a parent filter that must also be passed in order for the this filter to pass an annotation.
-
-