}
catchAndRethrow.add(expected);
}
// return the code block.
final RethrowDeclaredExceptionTemplatedFile rethrow = new RethrowDeclaredExceptionTemplatedFile();
return new CollectionTemplatedCodeBlock<Type>() {
@Override
public InputStream getInputStream() {
return rethrow.getInputStream();
}
@Override
protected Object getValue0(final String name) {
return rethrow.getValue0(name);
}
@Override
protected Collection<Type> getCollection() {
return catchAndRethrow;
}
@Override
protected void prepareToWrite(final Type type ) {
rethrow.setException( type );
}
@Override
protected void writeBetweenElements(final SourceWriter writer) {
writer.println();