code: @SuppressWarnings({ "rawtypes", "unchecked" })
      protected Object convertType(Class<?> newType, Object value) throws InstantiationException, IllegalAccessException, InvocationTargetException {
          // try call constructor
          Class<?>[] types = {value.getClass()};
          try {
              Constructor<?> constructor = newType.getConstructor(types);
              Object[] arguments = {value};
              return constructor.newInstance(arguments);
          } catch (NoSuchMethodException e) {
              // try using the transformers
              Function function = getTypeFunction(newType);
              if (function != null) {
                  return function.apply(value);
              }
              return value;
          }
      }
docs: Converts the given value to the given type.  First, reflection is
  is used to find a public constructor declared by the given class
  that takes one argument, which must be the precise type of the
  given value.  If such a constructor is found, a new object is
  created by passing the given value to that constructor, and the
  newly constructed object is returned.<P>
  <p>
  If no such constructor exists, and the given type is a primitive
  type, then the given value is converted to a string using its
  {@link Object#toString() toString()} method, and that string is
  parsed into the correct primitive type using, for instance,
  {@link Integer#valueOf(String)} to convert the string into an
  {@code int}.<P>
  <p>
  If no special constructor exists and the given type is not a
  primitive type, this method returns the original value.
  
  @param newType the type to convert the value to
  @param value   the value to convert
  @return the converted value
  @throws NumberFormatException     if newType is a primitive type, and
  the string representation of the given value cannot be converted
  to that type
  @throws InstantiationException    if the constructor found with
  reflection raises it
  @throws InvocationTargetException if the constructor found with
  reflection raises it
  @throws IllegalAccessException    never