public static <T> T getManagementBean(FacesContext ctx, Class<T> clazs) { ManagedBean annotation = clazs.getAnnotation(ManagedBean.class); if (annotation == null) { return null; } Object mgmtBean = ctx.getELContext().getELResolver().getValue(ctx.getELContext(), null, annotation.name()); return clazs.cast(mgmtBean); }
private boolean isBeanWithManagedBeanAnnotation(ProcessAnnotatedType processAnnotatedType) { Class<?> beanClass = processAnnotatedType.getAnnotatedType().getJavaClass(); return beanClass.isAnnotationPresent(ManagedBean.class); }