code: public static Object convert(final Object value, Class<?> targetType, final String name) {
          if (value == null) {
              if (targetType.equals(Boolean.TYPE)) {
                  return false;
              }
              return value;
          }
  
          final Class<? extends Object> actualType = value.getClass();
  
          if (targetType.isPrimitive()) {
              targetType =  PrimitiveTypes.valueOf(targetType.toString().toUpperCase()).getWraper();
          }
  
          if (targetType.isAssignableFrom(actualType)) {
              return value;
          }
  
          if (Number.class.isAssignableFrom(actualType) && Number.class.isAssignableFrom(targetType)) {
              return value;
          }
  
          if (!(value instanceof String)) {
              final String message = String.format("Expected type '%s' for '%s'. Found '%s'", targetType.getName(), name, actualType.getName());
              throw new IllegalArgumentException(message);
          }
  
          final String stringValue = (String) value;
  
          if (Enum.class.isAssignableFrom(targetType)) {
              final Class<? extends Enum> enumType = (Class<? extends Enum>) targetType;
              try {
                  return Enum.valueOf(enumType, stringValue);
              } catch (final IllegalArgumentException e) {
                  try {
                      return Enum.valueOf(enumType, stringValue.toUpperCase());
                  } catch (final IllegalArgumentException e1) {
                      return Enum.valueOf(enumType, stringValue.toLowerCase());
                  }
              }
          }
  
          try {
              // Force static initializers to run
              Class.forName(targetType.getName(), true, targetType.getClassLoader());
          } catch (final ClassNotFoundException e) {
              e.printStackTrace();
          }
  
          final PropertyEditor editor = Editors.get(targetType);
  
          if (editor == null) {
              final Object result = create(targetType, stringValue);
              if (result != null) {
                  return result;
              }
          }
  
          if (editor == null) {
              final String message = String.format("Cannot convert to '%s' for '%s'. No PropertyEditor", targetType.getName(), name);
              throw new IllegalArgumentException(message);
          }
  
          editor.setAsText(stringValue);
          return editor.getValue();
      }
docs: Todo : change this so the Cmd class being used in the conversion
  can itself have "editor" methods -- static methods like the ones below
  
  The 'public static Foo create(String)' method would take precedence over
  all other "editor" logic.