code: public static String emptyToNull(String str) {
          return (str != null && !str.isEmpty()) ? str : null;
      }
docs: Transform an empty string into null.
  
  @param str String to check.
  @return The string if it was non-empty, or null otherwise.