use of org.eclipse.persistence.internal.security.PrivilegedAccessHelper in project eclipselink by eclipse-ee4j.
the class InheritancePolicy method convertClassNamesToClasses.
/**
* INTERNAL:
* Convert all the class-name-based settings in this InheritancePolicy to actual class-based settings.
* This method is used when converting a project that has been built with class names to a project with classes.
* It will also convert referenced classes to the versions of the classes from the classLoader.
*/
public void convertClassNamesToClasses(ClassLoader classLoader) {
Iterator keysEnum = getClassNameIndicatorMapping().keySet().iterator();
Iterator valuesEnum = getClassNameIndicatorMapping().values().iterator();
// Clear old classes (after class names have been lazy initialized).
classIndicatorMapping = new HashMap();
while (keysEnum.hasNext()) {
Object key = keysEnum.next();
Object value = valuesEnum.next();
Class<?> theClass = convertClassNameToClass((String) key, classLoader);
classIndicatorMapping.put(theClass, value);
classIndicatorMapping.put(value, theClass);
}
// Initialize the parent class name.
if (getParentClassName() != null) {
setParentClass(convertClassNameToClass(getParentClassName(), classLoader));
}
// Initialize the class extractor name.
if (classExtractorName != null) {
Class<ClassExtractor> classExtractorClass = convertClassNameToClass(classExtractorName, classLoader);
setClassExtractor(PrivilegedAccessHelper.callDoPrivilegedWithException(() -> PrivilegedAccessHelper.<ClassExtractor>newInstanceFromClass(classExtractorClass), (ex) -> ValidationException.reflectiveExceptionWhileCreatingClassInstance(classExtractorName, ex)));
}
}
Aggregations