code: public static UIComponent getCurrentCompositeComponent(FacesContext context) {
        // return (UIComponent)context.getAttributes().get(UIComponent.CURRENT_COMPOSITE_COMPONENT);
          Map<Object, Object> contextAttributes = context.getAttributes();
          ArrayDeque<UIComponent> compositeELStack = _getComponentELStack(_CURRENT_COMPOSITE_COMPONENT_STACK_KEY,
                                                               contextAttributes);
          return compositeELStack.peek();
      }
docs: <p class="changed_added_2_0">Return the closest ancestor
  component, relative to the component returned from {@link
  #getCurrentComponent}, that is a composite component, or
  <code>null</code> if no such component exists.</p>
  
  @param context {@link FacesContext} for the request we are processing
  
  @throws NullPointerException if <code>context</code>
  is <code>null</code>
  
  @since 2.0