org.jcreme.filters
Class NaiveFilterCache

java.lang.Object
  extended byorg.jcreme.filters.NaiveFilterCache
All Implemented Interfaces:
FilterCache

public class NaiveFilterCache
extends java.lang.Object
implements FilterCache

This implementation of the FilterCache interface is naive because for a filter to be valid it must have been explicitly validated. Actually any Filter that equals a registered Filter will be considered valid.

Version:
$Revision: 1.2 $
Author:
$Author: dbregeon $

Constructor Summary
NaiveFilterCache()
           
 
Method Summary
 Filter[] getFilters()
          Enables access to the filters stored in this instance.
 void invalidate(Filter filter)
          "Invalidates" the given filter.
 void invalidate(java.lang.Object obj)
          Invalidates all the filters contained in this class that "accept" the object.
 void invalidateAll()
          Invalidate all the filters contained in this instance.
 boolean isValid(Filter filter)
          Tells whether a filter is a "valid" one.
 void validate(Filter filter)
          Tags the given filter as "valid".
 boolean validates(java.lang.Object obj)
          This method enables to test whether an Object is accepted by at least one of the Caches present in the FilterCache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NaiveFilterCache

public NaiveFilterCache()
Method Detail

isValid

public boolean isValid(Filter filter)
Tells whether a filter is a "valid" one. A valid filter is simply a Filter that was registered in the FilterCache.

Specified by:
isValid in interface FilterCache
Parameters:
filter - The Filter object we want to know about.
Returns:
True if the passed in filter is valid, false otherwise.

validate

public void validate(Filter filter)
Tags the given filter as "valid".

Specified by:
validate in interface FilterCache
Parameters:
filter - The filter we want to set as "valid".

invalidate

public void invalidate(Filter filter)
"Invalidates" the given filter. This means that the Filter is removed from the FilterCache.

Specified by:
invalidate in interface FilterCache
Parameters:
filter - The Filter object we want to invalidate.

invalidate

public void invalidate(java.lang.Object obj)
Invalidates all the filters contained in this class that "accept" the object.

Specified by:
invalidate in interface FilterCache
Parameters:
obj - the object to be tested against the Filters present in this FilterCache.

validates

public boolean validates(java.lang.Object obj)
This method enables to test whether an Object is accepted by at least one of the Caches present in the FilterCache.

Specified by:
validates in interface FilterCache
Parameters:
obj - the object to be tested against the Filters present in this FilterCache.
Returns:
true if the object would invalidate a filter contained in this class.

getFilters

public Filter[] getFilters()
Description copied from interface: FilterCache
Enables access to the filters stored in this instance.

Specified by:
getFilters in interface FilterCache
Returns:
the filters stored.
See Also:
FilterCache.getFilters()

invalidateAll

public void invalidateAll()
Description copied from interface: FilterCache
Invalidate all the filters contained in this instance.

Specified by:
invalidateAll in interface FilterCache
See Also:
FilterCache.invalidateAll()


Copyright 2006 null. All Rights Reserved.