static ValueExpression restore(Object value, Class type, FacesContext context) {
    if (value == null) return null;

    String expr = (String) value;

    Application app = context.getApplication();
    ExpressionFactory factory = app.getExpressionFactory();

    return factory.createValueExpression(context.getELContext(), expr, type);
  }
  static ValueExpression restoreWithType(Object value, FacesContext context) {
    if (value == null) return null;

    Object[] state = (Object[]) value;

    String expr = (String) state[0];
    Class type = (Class) state[1];

    Application app = context.getApplication();
    ExpressionFactory factory = app.getExpressionFactory();

    return factory.createValueExpression(context.getELContext(), expr, type);
  }