code: @SuppressWarnings("unchecked")
      public <T> T to(Class<T> classOfT, String pattern) {
          if (classOfT == null) {
              return null;
          }
  
          if (classOfT.isArray()) {
              Class<?> componentType = classOfT.getComponentType();
              // cheat by not instantiating a ParameterValue for every value
              ParameterValue parameterValue = newParameterValuePlaceHolder();
              List<String> list = toList();
              Object array = Array.newInstance(componentType, list.size());
  
              for (int i = 0; i < list.size(); i++) {
                  String value = list.get(i);
                  parameterValue.values[0] = value;
                  Object object = parameterValue.toObject(componentType, pattern);
                  Array.set(array, i, object);
              }
              return (T) array;
          } else {
              return (T) toObject(classOfT, pattern);
          }
      }
docs: Converts a string value(s) to the target type. You may optionally specify
  a string pattern to assist in the type conversion.
  
  @param classOfT
  @param pattern  optional pattern for interpreting the underlying request
  string value. (used for date & time conversions)
  @return an object