/** * Add the given converter to the handler. * * @param formal expected formal type * @param actual provided argument type * @param converter converter * @since 2.0 */ @Override public void addConverter(Class formal, Class actual, Converter converter) { Pair<Class, Class> key = new Pair<>(formal, actual); converterCacheMap.put(key, converter); if (formal.isPrimitive()) { key = new Pair<>(IntrospectionUtils.getBoxedClass(formal), actual); converterCacheMap.put(key, converter); } else { Class unboxedFormal = IntrospectionUtils.getUnboxedClass(formal); if (unboxedFormal != formal) { key = new Pair<>(unboxedFormal, actual); converterCacheMap.put(key, converter); } } } }
for (int i = 0; i < args.length; ++i) unboxedArgs[i] = IntrospectionUtils.getUnboxedClass(args[i]);