boolean rendered = (parentRendered && uiComponent.isRendered());
// If the specified UIComponent has cleanup abilities and it is not rendered, then instruct it to encode its
// cleanup markup to the response.
if (uiComponent instanceof UICleanup) {
UICleanup uiCleanup = (UICleanup) uiComponent;
if (!rendered) {
uiCleanup.encodeCleanup(facesContext);
}
}
// Otherwise, recurse through all of the children.
else {