private final static Logger logger = LoggerFactory.getLogger(TransformerFactory.class);
public final static Transformer<?> generateTransformer(Object action) {
Transformer<?> transformer;
if (action instanceof String) {
transformer = new ElementSetterTransformer(new TextSetter(action.toString()));
} else if (action instanceof ElementSetter) {
transformer = new ElementSetterTransformer((ElementSetter) action);
} else if (action instanceof Renderer) {
transformer = new RendererTransformer((Renderer) action);
} else if (action instanceof Future) {
transformer = new FutureTransformer((Future<?>) action);
} else if (action instanceof Element) {
transformer = new ElementTransformer((Element) action);
} else {
String msg = "Unsupported type found in transformer generation:" + action.getClass().getName();
Asta4DWarningException awe = new Asta4DWarningException(msg);
logger.warn(msg, awe);
transformer = new ElementSetterTransformer(new TextSetter(action.toString()));
}
return transformer;
}