use of org.drools.core.util.ClassUtils in project drools by kiegroup.
the class KieContainerImpl method reinitModifiedClasses.
private Collection<Class<?>> reinitModifiedClasses(InternalKieModule newKM, List<String> modifiedClasses, ClassLoader classLoader, boolean modifyingUsedClass) {
if (modifiedClasses.isEmpty() || !(classLoader instanceof ProjectClassLoader)) {
return Collections.emptyList();
}
Set<String> reloadedClasses = new HashSet<>(modifiedClasses);
ProjectClassLoader projectClassLoader = (ProjectClassLoader) classLoader;
projectClassLoader.clearStore();
if (modifyingUsedClass) {
reloadedClasses.addAll(projectClassLoader.reinitTypes().stream().map(ClassUtils::convertClassToResourcePath).collect(toList()));
}
List<Class<?>> classes = new ArrayList<Class<?>>();
for (String resourceName : reloadedClasses) {
String className = convertResourceToClassName(resourceName);
byte[] bytes = newKM.getBytes(resourceName);
if (bytes != null) {
Class<?> clazz = projectClassLoader.defineClass(className, resourceName, bytes);
classes.add(clazz);
}
}
return classes;
}
Aggregations