com.ryanm.logging
Class AbstractSink

java.lang.Object
  extended by com.ryanm.logging.AbstractSink
All Implemented Interfaces:
Configurable, LogSink
Direct Known Subclasses:
StringSink

public abstract class AbstractSink
extends java.lang.Object
implements LogSink

Eases implementation of LogSinks by handling listener management, change notification, and preferences handling

Author:
ryanm

Constructor Summary
AbstractSink(java.lang.String title)
          Constructs a new Sink with the specified title
 
Method Summary
 void addSinkListener(SinkListener listener)
          Adds a listener object to this sink.
 java.lang.String getTitle()
          Gets a title for this sink
protected  void notifyListeners()
          Method that should be called by subclasses when something changes
 void removeSinkListener(SinkListener listener)
          Removes a listener object from this sink.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ryanm.logging.LogSink
log
 
Methods inherited from interface com.ryanm.config.Configurable
getConfigurator
 

Constructor Detail

AbstractSink

public AbstractSink(java.lang.String title)
Constructs a new Sink with the specified title

Parameters:
title - The title for the new sink. Titles should be unique among sinks
Method Detail

getTitle

public final java.lang.String getTitle()
Description copied from interface: LogSink
Gets a title for this sink

Specified by:
getTitle in interface LogSink
Returns:
A title for this sink

addSinkListener

public void addSinkListener(SinkListener listener)
Description copied from interface: LogSink
Adds a listener object to this sink. The listener will henceforth be advised of any changes to this sink. Duplicate additions of the same listener will be ignored.

Specified by:
addSinkListener in interface LogSink
Parameters:
listener - The listener to add

removeSinkListener

public void removeSinkListener(SinkListener listener)
Description copied from interface: LogSink
Removes a listener object from this sink. The listener will henceforth NOT be advised of any changes to this sink. Removals of an unknown listener will be ignored

Specified by:
removeSinkListener in interface LogSink
Parameters:
listener - The listener to remove

notifyListeners

protected void notifyListeners()
Method that should be called by subclasses when something changes