code: @SuppressWarnings("unchecked")
      public static <T> T coerceToType(FacesContext facesContext, Object value, Class<? extends T> desiredClass)
      {
          if (value == null)
          {
              return null;
          }
  
          try
          {
              ExpressionFactory expFactory = facesContext.getApplication().getExpressionFactory();
              // Use coersion implemented by JSP EL for consistency with EL
              // expressions. Additionally, it caches some of the coersions.
              return (T)expFactory.coerceToType(value, desiredClass);
          }
          catch (ELException e)
          {
              String message = "Cannot coerce " + value.getClass().getName()
                      + " to " + desiredClass.getName();
              log.log(Level.SEVERE, message , e);
              throw new FacesException(message, e);
          }
      }
docs: to unified EL in JSF 1.2