org.hamcrest.generator
Class HamcrestFactoryWriter

java.lang.Object
  extended by org.hamcrest.generator.HamcrestFactoryWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, FactoryWriter

public class HamcrestFactoryWriter
extends java.lang.Object
implements FactoryWriter

FactoryWriter that outputs Java code which simply delegates all Hamcrest factory methods to factory methods elsewhere. This is useful for grouping lots of matcher classes into one class, so you only have to look in one place for matchers.

Author:
Joe Walnes
See Also:
FactoryWriter

Constructor Summary
HamcrestFactoryWriter(java.lang.String javaPackageName, java.lang.String javaClassName, java.io.Writer output)
           
 
Method Summary
 void close()
           
 void flush()
           
 void writeFooter()
          Write any necessary code to finish the output.
 void writeHeader()
          Write the code header.
 void writeMethod(java.lang.String generatedMethodName, FactoryMethod factoryMethodToDelegateTo)
          Writes code that delegates to a method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HamcrestFactoryWriter

public HamcrestFactoryWriter(java.lang.String javaPackageName,
                             java.lang.String javaClassName,
                             java.io.Writer output)
Method Detail

writeHeader

public void writeHeader()
                 throws java.io.IOException
Description copied from interface: FactoryWriter
Write the code header.

Specified by:
writeHeader in interface FactoryWriter
Throws:
java.io.IOException

writeFooter

public void writeFooter()
                 throws java.io.IOException
Description copied from interface: FactoryWriter
Write any necessary code to finish the output.

Specified by:
writeFooter in interface FactoryWriter
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface java.io.Flushable
Throws:
java.io.IOException

writeMethod

public void writeMethod(java.lang.String generatedMethodName,
                        FactoryMethod factoryMethodToDelegateTo)
                 throws java.io.IOException
Description copied from interface: FactoryWriter
Writes code that delegates to a method.

Specified by:
writeMethod in interface FactoryWriter
Throws:
java.io.IOException