* @return a Transformer for this key, or null if the key type is not properly annotated.
* @throws IllegalAccessException if a Transformer instance cannot be created via reflection.
* @throws InstantiationException if a Transformer instance cannot be created via reflection.
*/
private static Transformer getTransformer(Class<?> keyClass) {
Transformable t = keyClass.getAnnotation(Transformable.class);
Transformer tf = null;
if (t != null) try {
// The cast should not be necessary but it's workaround for a compiler bug.
tf = (Transformer) t.transformer().newInstance();
} catch (Exception e) {
log.couldNotInstantiaterTransformerClass(t.transformer(), e);
}
return tf;
}