/**
   * RichFaces PartialViewContext implementation does not have any getWrapped() method to return the
   * wrapped PartialViewContext. So a reflection hack is necessary to return it from the private
   * field.
   *
   * @return The wrapped PartialViewContext from the RichFaces PartialViewContext implementation.
   */
  public static PartialViewContext getRichFacesWrappedPartialViewContext() {
    final PartialViewContext richFacesContext = Hacks.getRichFacesPartialViewContext();

    if (richFacesContext != null) {
      return Hacks.accessField(richFacesContext, "wrappedViewContext");
    }

    return null;
  }
  /**
   * RichFaces PartialViewContext implementation does not have the getRenderIds() method properly
   * implemented. So a hack wherin the exact name of the private field needs to be known has to be
   * used to properly extract it from the RichFaces PartialViewContext implementation.
   *
   * @return The render IDs from the RichFaces PartialViewContext implementation.
   */
  public static Collection<String> getRichFacesRenderIds() {
    final PartialViewContext richFacesContext = Hacks.getRichFacesPartialViewContext();

    if (richFacesContext != null) {
      final Collection<String> renderIds =
          Hacks.accessField(richFacesContext, "componentRenderIds");

      if (renderIds != null) {
        return renderIds;
      }
    }

    return Collections.emptyList();
  }