Holger's
Java API

com.antelmann.util
Class VerboseFilter.Adapter<T>

java.lang.Object
  extended by com.antelmann.util.VerboseFilter.Adapter<T>
All Implemented Interfaces:
Filter<T>, VerboseFilter<T>, Wrapped<Filter<T>>
Enclosing interface:
VerboseFilter<T>

public static class VerboseFilter.Adapter<T>
extends Object
implements VerboseFilter<T>, Wrapped<Filter<T>>


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.antelmann.util.VerboseFilter
VerboseFilter.Adapter<T>
 
Field Summary
 
Fields inherited from interface com.antelmann.util.Filter
EXCLUDE_ALL_FILTER, INCLUDE_ALL_FILTER
 
Constructor Summary
VerboseFilter.Adapter()
           
VerboseFilter.Adapter(Filter<T> filter)
           
VerboseFilter.Adapter(Filter<T> filter, PatternExtractor<? super T,String> messageExtractor)
           
VerboseFilter.Adapter(PatternExtractor<? super T,String> messageExtractor)
          allows those entries that generate a null message by the extractor
 
Method Summary
 boolean accept(T entry)
          returns true only if the given entry is accepted by this filter
static String extractMessage(Filter<?> filter, Object entry)
          convenience method to easily extract a rejection message from any filter
static String extractMessage(Filter<?> filter, Object entry, String defaultMessage)
          convenience method to easily extract a rejection message from any filter
 PatternExtractor<? super T,String> getMessageExtractor()
           
 String getRejectionMessage(T entry)
          provides a message telling the caller why a given element is not accepted by this filter
 void setMessageExtractor(PatternExtractor<? super T,String> pe)
           
 Filter<T> unwrap()
          returns the embedded instance that this wrapper encloses
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VerboseFilter.Adapter

public VerboseFilter.Adapter()

VerboseFilter.Adapter

public VerboseFilter.Adapter(Filter<T> filter)

VerboseFilter.Adapter

public VerboseFilter.Adapter(PatternExtractor<? super T,String> messageExtractor)
allows those entries that generate a null message by the extractor


VerboseFilter.Adapter

public VerboseFilter.Adapter(Filter<T> filter,
                             PatternExtractor<? super T,String> messageExtractor)
Method Detail

getMessageExtractor

public PatternExtractor<? super T,String> getMessageExtractor()

setMessageExtractor

public void setMessageExtractor(PatternExtractor<? super T,String> pe)

accept

public boolean accept(T entry)
Description copied from interface: Filter
returns true only if the given entry is accepted by this filter

Specified by:
accept in interface Filter<T>

unwrap

public Filter<T> unwrap()
Description copied from interface: Wrapped
returns the embedded instance that this wrapper encloses

Specified by:
unwrap in interface Wrapped<Filter<T>>

getRejectionMessage

public String getRejectionMessage(T entry)
Description copied from interface: VerboseFilter
provides a message telling the caller why a given element is not accepted by this filter

Specified by:
getRejectionMessage in interface VerboseFilter<T>
Parameters:
entry - the element that is to be filtered; the entry may be null (in which case a generic rejection message is provided
Returns:
null if the element is accepted by this filter or an appropriate message telling why the given element is not accepted

extractMessage

public static String extractMessage(Filter<?> filter,
                                    Object entry)
                             throws ClassCastException
convenience method to easily extract a rejection message from any filter

Throws:
ClassCastException

extractMessage

public static String extractMessage(Filter<?> filter,
                                    Object entry,
                                    String defaultMessage)
                             throws ClassCastException
convenience method to easily extract a rejection message from any filter

Throws:
ClassCastException


(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads