code: public String extractString(Object val) {
      try {
        return (String) val;
      } catch (ClassCastException cce) {
        logException(cce);
        return null;
      }
    }
docs: Extracts a String from a result consisting entirely of a String.
  @param val
  @return the String