com.topologi.diffx.format
Class MultiplexFormatter

java.lang.Object
  extended by com.topologi.diffx.format.MultiplexFormatter
All Implemented Interfaces:
DiffXFormatter

public final class MultiplexFormatter
extends Object
implements DiffXFormatter

A formatter which can relay the method calls to multiple formatters.

Version:
11 December 2008
Author:
Christophe Lauret

Constructor Summary
MultiplexFormatter()
          Creates a new formatter without any underlying formatters.
MultiplexFormatter(DiffXFormatter f)
          Creates a new formatter wrapping the specified formatter.
 
Method Summary
 void add(DiffXFormatter f)
          Adds a formatter to multiplex.
 void delete(DiffXEvent e)
          Formats the specified deleted event.
 void format(DiffXEvent e)
          Formats the specified event.
 void insert(DiffXEvent e)
          Formats the specified inserted event.
 void setConfig(DiffXConfig config)
          Sets the configuration to use with this formatter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiplexFormatter

public MultiplexFormatter()
Creates a new formatter without any underlying formatters.


MultiplexFormatter

public MultiplexFormatter(DiffXFormatter f)
Creates a new formatter wrapping the specified formatter.

Parameters:
f - The formatter to use.
Method Detail

add

public void add(DiffXFormatter f)
Adds a formatter to multiplex.

Parameters:
f - The Diff-X formatter to add.

format

public void format(DiffXEvent e)
            throws IOException
Description copied from interface: DiffXFormatter
Formats the specified event.

Specified by:
format in interface DiffXFormatter
Parameters:
e - The event to format
Throws:
IOException - Should an I/O exception occurs while formatting.

insert

public void insert(DiffXEvent e)
            throws IOException
Description copied from interface: DiffXFormatter
Formats the specified inserted event.

Specified by:
insert in interface DiffXFormatter
Parameters:
e - The event to format
Throws:
IOException - Should an I/O exception occurs while formatting.

delete

public void delete(DiffXEvent e)
            throws IOException,
                   IllegalStateException
Description copied from interface: DiffXFormatter
Formats the specified deleted event.

Specified by:
delete in interface DiffXFormatter
Parameters:
e - The event to format
Throws:
IOException - Should an I/O exception occurs while formatting.
IllegalStateException - If the formatter is not in a state to run this method.

setConfig

public void setConfig(DiffXConfig config)
Description copied from interface: DiffXFormatter
Sets the configuration to use with this formatter.

Specified by:
setConfig in interface DiffXFormatter
Parameters:
config - The configuration to use.