title: Null-safe valueOf method
body: <p>I need to convert several String values to Integer,Boolean, etc., however since the input values may be null I can't use the <code>Integer.valueOf()</code> method for example. If the input is null I need the output object to be null as well, so I can't use <a href="http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/math/NumberUtils.html#toInt%28java.lang.String%29" rel="noreferrer">apache commons NumberUtils.toInt()</a>. Is there an existing implementation or a better solution than just writing a utility method for each type(Integer, Boolean etc.)?</p>
  
  <p>Edit: adding code sample</p>
  
  <p><code>String maxAgeStr = settings.get("maxAge"); //settings is a map, which may or 
                                              //may not contain maxAge
  constraints.setMaxAge(Integer.valueOf(maxAgeStr)); // need null safety here
  String enableActionStr = settings.get("enableAction");
  constraints.setEnableAction(Boolean.valueOf(enableActionStr)); // need null safety here</code></p>