code: public static Object convert(final String value, final Class<?> type) {
  
          final Object result;
  
          if (value == null) {
              result = null;
          } else if (type.isPrimitive()) {
              result = toPrimitive(value, type);
          } else if (OBJECT_TO_PRIMITIVE_TYPE_MAP.containsKey(type)) {
              result = valueOf(value, type);
          } else {
              result = value;
          }
          return result;
      }
docs: Converts the given string representation of a value to an instance of the specified type. Supported types are:
  <ul> <li>any primitive type</li> <li>any primitive object type (i.e. Integer.class)</li> <li>any type with a
  constructor accepting a single string argument containing the representation of the type</li> </ul>
  
  @param value
  the value to be converted. The value may be null.
  @param type
  the target type for the conversion. The type must not be null.
  
  @return an instance of the type representing the specified string value. If the value can not be converted, the
  original value will be returned.