org.apache.logging.log4j.core.filter
Class AbstractFilterable

java.lang.Object
  extended by org.apache.logging.log4j.core.AbstractLifeCycle
      extended by org.apache.logging.log4j.core.filter.AbstractFilterable
All Implemented Interfaces:
Serializable, Filterable, LifeCycle
Direct Known Subclasses:
AbstractAppender, AbstractConfiguration, AppenderControl, LoggerConfig

public abstract class AbstractFilterable
extends AbstractLifeCycle
implements Filterable

Enhances a Class by allowing it to contain Filters.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle
LifeCycle.State
 
Field Summary
 
Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
LOGGER
 
Constructor Summary
protected AbstractFilterable()
           
protected AbstractFilterable(Filter filter)
           
 
Method Summary
 void addFilter(Filter filter)
          Adds a filter.
 Filter getFilter()
          Returns the Filter.
 boolean hasFilter()
          Determines if a Filter is present.
 boolean isFiltered(LogEvent event)
          Determine if the LogEvent should be processed or ignored.
 void removeFilter(Filter filter)
          Removes a Filter.
 void start()
          Make the Filter available for use.
 void stop()
          Cleanup the Filter.
 
Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
equalsImpl, getState, hashCodeImpl, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.logging.log4j.core.LifeCycle
getState, isStarted, isStopped
 

Constructor Detail

AbstractFilterable

protected AbstractFilterable(Filter filter)

AbstractFilterable

protected AbstractFilterable()
Method Detail

getFilter

public Filter getFilter()
Returns the Filter.

Specified by:
getFilter in interface Filterable
Returns:
the Filter or null.

addFilter

public void addFilter(Filter filter)
Adds a filter.

Specified by:
addFilter in interface Filterable
Parameters:
filter - The Filter to add.

removeFilter

public void removeFilter(Filter filter)
Removes a Filter.

Specified by:
removeFilter in interface Filterable
Parameters:
filter - The Filter to remove.

hasFilter

public boolean hasFilter()
Determines if a Filter is present.

Specified by:
hasFilter in interface Filterable
Returns:
false if no Filter is present.

start

public void start()
Make the Filter available for use.

Specified by:
start in interface LifeCycle
Overrides:
start in class AbstractLifeCycle

stop

public void stop()
Cleanup the Filter.

Specified by:
stop in interface LifeCycle
Overrides:
stop in class AbstractLifeCycle

isFiltered

public boolean isFiltered(LogEvent event)
Determine if the LogEvent should be processed or ignored.

Specified by:
isFiltered in interface Filterable
Parameters:
event - The LogEvent.
Returns:
true if the LogEvent should be processed.


Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.