/** * Get the (possibly cached) index for a given class. * * @param clazz the class * @return the index */ @SuppressWarnings({"unchecked"}) public synchronized ClassReflectionIndex getClassIndex(Class clazz) { try { ClassReflectionIndex index = classes.get(clazz); if (index == null) { final SecurityManager sm = System.getSecurityManager(); if (sm == null) { index = new ClassReflectionIndex(clazz, this); } else { index = AccessController.doPrivileged((PrivilegedAction<ClassReflectionIndex>) () -> new ClassReflectionIndex(clazz, this)); } classes.put(clazz, index); } return index; } catch (Throwable e) { throw ServerLogger.ROOT_LOGGER.errorGettingReflectiveInformation(clazz, clazz.getClassLoader(), e); } } }
/** * Get the (possibly cached) index for a given class. * * @param clazz the class * @return the index */ @SuppressWarnings({"unchecked"}) public synchronized ClassReflectionIndex getClassIndex(Class clazz) { try { ClassReflectionIndex index = classes.get(clazz); if (index == null) { final SecurityManager sm = System.getSecurityManager(); if (sm == null) { index = new ClassReflectionIndex(clazz, this); } else { index = AccessController.doPrivileged((PrivilegedAction<ClassReflectionIndex>) () -> new ClassReflectionIndex(clazz, this)); } classes.put(clazz, index); } return index; } catch (Throwable e) { throw ServerLogger.ROOT_LOGGER.errorGettingReflectiveInformation(clazz, clazz.getClassLoader(), e); } } }
/** * Get the (possibly cached) index for a given class. * * @param clazz the class * @return the index */ @SuppressWarnings({"unchecked"}) public synchronized <T> ClassReflectionIndex<T> getClassIndex(Class<T> clazz) { try { ClassReflectionIndex<T> index = (ClassReflectionIndex<T>) classes.get(clazz); if (index == null) { classes.put(clazz, index = new ClassReflectionIndex<T>(clazz, this)); } return index; } catch (Throwable e) { throw ServerMessages.MESSAGES.errorGettingReflectiveInformation(clazz, clazz.getClassLoader(), e); } } }
/** * Get the (possibly cached) index for a given class. * * @param clazz the class * @return the index */ @SuppressWarnings({"unchecked"}) public synchronized <T> ClassReflectionIndex<T> getClassIndex(Class<T> clazz) { try { ClassReflectionIndex<T> index = (ClassReflectionIndex<T>) classes.get(clazz); if (index == null) { classes.put(clazz, index = new ClassReflectionIndex<T>(clazz, this)); } return index; } catch (Throwable e) { throw ServerMessages.MESSAGES.errorGettingReflectiveInformation(clazz, clazz.getClassLoader(), e); } } }