Why is passing in a writer allowed here?  I'd suggest injecting the writer directly instead, and if some kind of context switching is needed, then it should be an implementation detail of a plugin-manager backed writer that selects the correct writer depending on context