@SuppressWarnings("unchecked") public static void inferResult(Object o) { // Return type inference if (o != null) { if (o instanceof NoResult) { return; } if (o instanceof Result) { // Of course throw (Result) o; } if (o instanceof InputStream) { Controller.renderBinary((InputStream) o); } if (o instanceof File) { Controller.renderBinary((File) o); } if (o instanceof Map) { Controller.renderTemplate((Map<String, Object>) o); } if (o instanceof Object[]) { Controller.render(o); } Controller.renderHtml(o); } }