protected WidgetBuilder renderLifecycleCallbacks(UIComponent component) throws IOException {
        Map<String, Object> attributes = component.getAttributes();

        Object preConstruct = attributes.get(Widget.CALLBACK_PRE_CONSTRUCT);
        if (preConstruct != null) {
            callback("preConstruct", "function(cfg)", preConstruct.toString());
        }

        Object postConstruct = attributes.get(Widget.CALLBACK_POST_CONSTRUCT);
        if (postConstruct != null) {
            callback("postConstruct", "function(widget)", postConstruct.toString());
        }

        Object postRefresh = attributes.get(Widget.CALLBACK_POST_REFRESH);
        if (postRefresh != null) {
            callback("postRefresh", "function(widget)", postRefresh.toString());
        }

        Object preDestroy = attributes.get(Widget.CALLBACK_PRE_DESTROY);
        if (preDestroy != null) {
            callback("preDestroy", "function(widget)", preDestroy.toString());
        }

        return this;
    }
@param widgetClass   Constructor name of the widget
@param widgetVar     Name of the client side widget
@param id            Client id of the component
@param endFunction   If the init script is wrapped by a method and if the endFunction parentheses should be rendered.
@throws IOException if any IO exception occurs
@return              The current instance.
primefaces/src/main/java/org/primefaces/util/WidgetBuilder.java