Add getTypeHandler(TypeInfo, Class...) overload
@@ -238,6 +238,13 @@ public void addTypeHandlerFactory(TypeHandlerFactory typeHandlerFactory) {
return getTypeHandler(TypeInfo.of(typeClass), contextClassLoaders);
}
+ @SuppressWarnings("unchecked")
+ public <T> Optional<TypeHandler<T>> getTypeHandler(TypeInfo<T> type, Class<?>... contextClasses) {
+ return getTypeHandler(type, Arrays.stream(contextClasses)
+ .map(Class::getClassLoader)
+ .toArray(ClassLoader[]::new));
+ }
+
@SuppressWarnings("unchecked")
public <T> Optional<TypeHandler<T>> getTypeHandler(TypeInfo<T> type, ClassLoader... contextClassLoaders) {
TypeHandlerFactoryContext context = new TypeHandlerFactoryContext(this, contextClassLoaders);
