
org.hamcrest.generator.FactoryWriter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hamcrest-generator Show documentation
Show all versions of hamcrest-generator Show documentation
A tool to allow many Matcher implementations to be combined into a single class so users don't have to remember many classes/packages to import. Generates code.
The newest version!
package org.hamcrest.generator;
import java.io.Closeable;
import java.io.Flushable;
import java.io.IOException;
/**
* Writes syntactic sugar code for factories.
* Implementations of this could include vanilla factory methods for
* Hamcrest matchers, wrapped factories for other libraries or factories
* in other languages (jython, jruby, groovy, etc).
*
Usage:
*
* writer.writeHeader(...);
*
* writer.writeMethod(...);
* writer.writeMethod(...);
* writer.writeMethod(...);
* ...
* writer.writeFooter(...);
* writer.close();
*
*
* @author Joe Walnes
* @see FactoryMethod
* @see SugarGenerator
* @see HamcrestFactoryWriter
*/
public interface FactoryWriter extends Closeable, Flushable {
/**
* Write the code header.
*/
void writeHeader() throws IOException;
/**
* Writes code that delegates to a method.
*
* @param generatedMethodName
* @param factoryMethodToDelegateTo
*/
void writeMethod(String generatedMethodName, FactoryMethod factoryMethodToDelegateTo) throws IOException;
/**
* Write any necessary code to finish the output.
*/
void writeFooter() throws IOException;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy