class ScriptUtils {

    public static String buildEventHandlerScript(String id, String eventName, String eventScript) {
        if (StringUtils.isBlank(eventScript)) {
            return "";
        }

        Assert.hasLength(id, "Id is required for building event handler script");
        Assert.hasLength(eventName, "Event name is required for building event handler script");

        StringBuffer sb = new StringBuffer();

        sb.append("jQuery('#" + id + "').on('");
        sb.append(eventName);
        sb.append("', function(e) {");
        sb.append(eventScript);
        sb.append("}); ");

        return sb.toString();
    }

}