I'm storing a set of Templates objects in a HashMap, instead of Transformer, to allow for the possibility of them being used in an MT environment, because apparently the Transformer class is not thread-safe.
However, I'm wondering whether the "identity Transformer" also is risky to use in an MT environment. That is, the Transformer that just copies the source to the destination, with no transformation. I wonder about this because it appears that there is no easy way to create a "Templates" object with an identity transform. The TransformerFactory class has two methods to create Transformer instances, one with a Source object, and one with no arguments, but there's only one method to create Templates objects, providing a Source parameter. In my processing loop, I normally pull out a Templates object my from my HashMap based on a message type. In some cases, that will be null, in case no transformation is needed for that message type. I'd prefer not to return null from my method, but just pretend a transformation was done, and just return the input text. Since my input is a Source object, it's really most straightforward to use the identity transform. It would be nice if I could cache an object to do that transformation instead of creating it on the fly (as much as possible).
