code: public static Object getPrimitiveValue(String value, PrimitiveCategory primitiveCategory) {
          if (value != null) {
              try {
                  switch (primitiveCategory) {
                      case BOOLEAN:
                          return Boolean.valueOf(value);
                      case BYTE:
                          return Byte.valueOf(value);
                      case DOUBLE:
                          return Double.valueOf(value);
                      case FLOAT:
                          return Float.valueOf(value);
                      case INT:
                          return Integer.valueOf(value);
                      case LONG:
                          return Long.valueOf(value);
                      case SHORT:
                          return Short.valueOf(value);
                      case STRING:
                          return value;
                      default:
                          throw new IllegalStateException(primitiveCategory.toString());
                  }
              } catch (Exception ignored) {
              }
          }
          return null;
      }
docs: Converts the string value to the java object for the given primitive category
  
  @param value
  the value
  @param primitiveCategory
  the primitive category
  @return the java object